After turn off "Append a separator to the end of the breadcrumb" is disabled, in the theme settings form is the checkbox checked. The default value is ok, the theme_get_setting('zen_breadcrumb_trailing'), get the proper value, something in '#states' could be wrong.

Comments

johnalbin’s picture

Status: Active » Postponed (maintainer needs more info)

I don't quite understand the bug description.

Can you describe more fully what you did, what you expected to happen, and what you actually saw happen?

caschbre’s picture

I'm experiencing the same thing with 7.x-5.x (from today). If you go to the zen theme (or subtheme) settings page and scroll down to this setting...

"Append a separator to the end of the breadcrumb"

The value is checked. In my subtheme .info file I have:

settings[zen_breadcrumb_trailing] = 0

I can also remove the check and save the settings form... but every time the theme settings page loads, that value is checked.

johnalbin’s picture

Status: Postponed (maintainer needs more info) » Active

The settings[zen_breadcrumb_trailing] = 0 is the default value for the setting. If you override it on the form, it will ignore the value in the .info file.

I can also remove the check and save the settings form... but every time the theme settings page loads, that value is checked.

But what you describe is definitely buggy behaviour. Unfortunately, it's not one I've encountered. And I haven't been able to reproduce it. :-(

echoz’s picture

I can reproduce this checkbox being re-checked upon reloading the settings screen, although the unchecked state had been respected, meaning I've unchecked "Append a separator to the end of the breadcrumb" and the separator is in fact not showing, even though the checkbox is showing rechecked when returning to the settings screen. Saving the settings screen for any subsequent reason without noticing that the separator checkbox has been unintentionally checked, will of course change your settings to append the separator. Bug :-(

johnalbin’s picture

In theme-settings.php, we have:

  $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_trailing'] = array(
    '#type'          => 'checkbox',
    '#title'         => t('Append a separator to the end of the breadcrumb'),
    '#default_value' => theme_get_setting('zen_breadcrumb_trailing'),
    '#description'   => t('Useful when the breadcrumb is placed just before the title.'),
    '#states' => array(
      'disabled' => array(
        ':input[name="zen_breadcrumb_title"]' => array('checked' => TRUE),
      ),
      'unchecked' => array(
        ':input[name="zen_breadcrumb_title"]' => array('checked' => TRUE),
      ),
    ),
  );

The states part is what is making the setting get changed. If you disable JS in your browser, the setting stays unchecked.

Looking at the code above, this looks like a core bug. The above code says to make zen_breadcrumb_trailing checkbox disabled and unchecked when zen_breadcrumb_title is checked. It does not say to do the opposite (make the checkbox checked when zen_breadcrumb_title is unchecked), but Drupal seems to be doing the opposite in addition to the desired behavior.

johnalbin’s picture

Hmm… It looks like the checked/unchecked is always a toggle effect. I'm sure the code used to behave differently, but whatever.

johnalbin’s picture

Title: Breadcrumb settings wrong default value » Breadcrumb setting won't stay unchecked
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.