When PURL’s behavior is set to disabled for an individual menu item, $options['purl’] holds array(‘disabled’ => 1).
When we set it to disabled for the whole menu, though, $options['purl'] holds the string, 'disabled'.

This second case is happening in _purl_menu_edit_submit_recurse():

    if ($behavior == 'disabled') {
      $link['options']['purl'] = 'disabled';
    }

So, when the whole menu has been disabled the check in _purl_skip() fails (at least in PHP >=5.4):

function _purl_skip($e, $o) {
  if (!empty($o['purl']['disabled'])) {
    return true;
  }

The fix should probably be to _purl_menu_edit_submit_recurse() -- do it the same way in all cases -- but, since I'm not sure whether there was a reason for doing it that way, I've made the conditional in _purl_skip() check for both cases.

function _purl_skip($e, $o) {
  if (isset($o['purl'])) {
    if (!empty($o['purl']['disabled']) || $o['purl'] == 'disabled') {
      return true;
    }
  }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeffschuler’s picture

Status: Active » Needs review
FileSize
554 bytes
webflo’s picture

I think we should fix the logic error in _purl_menu_edit_submit_recurse.