I can tell that my access_callback function is being invoked, but the superfish module is ignoring the return value from the function. I isolated this to a repro case on a fresh installation of the latest release versions of Drupal 7 and the superfish module. I have a couple of menu items which I created in the repro module, defaulting to the navigation parent menu (see the code below, which I moved to the end of the report to avoid the ugly appearance introduced by this site's trimming filter, which was chopping in the middle of the code fragment, destroying the code formatting).
After configuring the superfish module to display the navigation menu in the header, and leaving the default display of the navigation menu in the first sidebar I now have two renderings of the same menu. With the repro module's code as it appears below, the menu item One is shown in both renderings of the navigation menu, and the menu item Two is shown in neither rendering. Now if I swap the return values of the two access_check_x() functions, so that the first is returning false and the second returns true, the display of the menu in the sidebar (the one done by core Drupal) honors the return values, so that "One" disappears and "Two" appears. That doesn't happen, however, for the rendering in the header (the one done by the superfish module), which still shows "One" but not "Two." Am I correct in my conclusion that this is a bug in the superfish module, and that if I want runtime control over menu item display, as well as the fancy handling of the submenu items, I'm going to have to roll my own?
Here's the repro code:
function sfrepro_menu() {
return array(
'one' => array(
'title' => 'One',
'page callback' => 'stub',
'access callback' => 'access_check_1',
),
'two' => array(
'title' => 'Two',
'page callback' => 'stub',
'access callback' => 'access_check_2',
),
);
}
function stub() { return '<p>Stub</p>'; }
function access_check_1() { return true; }
function access_check_2() { return false; }
Comments
Comment #1
mehrpadin commentedOne of those forgotten issues :\ access callbacks are not being ignored, that's for sure! will close this, feel free to reopen if necessary.
Comment #2
bklineI have confirmed that the menus are behaving correctly now, even with the version of this module against which the bug was reported, so presumably the bug was deeper within Drupal, and was fixed some time between now and two years ago (!) when I reported the problem. Two years is a long time to get a response to a bug report.
Comment #3
mehrpadin commented:) I do apologise for that, used to think it was replied to and closed long ago, or maybe I really did but haven't clicked "Save" :D