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;
}
}
Comment | File | Size | Author |
---|---|---|---|
#2 | purl-disabled_for_menu-2406621-2.patch | 696 bytes | webflo |
#1 | purl-disabled_for_menu-2406621-1.patch | 554 bytes | jeffschuler |
Comments
Comment #1
jeffschulerComment #2
webflo CreditAttribution: webflo commentedI think we should fix the logic error in
_purl_menu_edit_submit_recurse
.