Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
test module:
menu_bug.info
name = Menu bug
core = 7.x
menu_bug.module
// Implements hook_menu().
function menu_bug_menu() {
$items['test1'] = array(
'title' => 'Test 1 (this page has a title)',
'page callback' => 'menu_page_callback',
'type' => MENU_NORMAL_ITEM,
'access callback' => TRUE,
);
$items['test2'] = array(
'title' => 'Test 2 (this page does not have a title)',
'page callback' => 'menu_page_callback',
'type' => MENU_CALLBACK,
'access callback' => TRUE,
);
return $items;
}
function menu_page_callback() {
return 'HELLO';
}
the test2 page does not have a title. This worked previously..
Comments
Comment #1
effulgentsia CreditAttribution: effulgentsia commentedPossibly related to #907690-55: Breadcrumbs don't work for dynamic paths & local tasks #2. I'm not sure this is really critical, or even a bug in light of that issue, but since it is a change from D6, I'll leave that to others to decide.
Comment #2
chx CreditAttribution: chx commenteduse MENU_VISIBLE_IN_BREADCRUMB
Comment #3
droplet CreditAttribution: droplet commentedI have closed around 5 same issues and I'm also confused about its by design or a bug, need Docs point developer to right way.
Comment #4
Dave Cohen CreditAttribution: Dave Cohen commentedIt's for sure not how Drupal 6.x behaved.
http://api.drupal.org/api/drupal/modules--system--system.api.php/functio... doesn't mention MENU_VISIBLE_IN_BREADCRUMB at all.
menu.inc refers to MENU_VISIBLE_IN_BREADCRUMB as an "internal menu flag" and not a "menu type".
All reasons to think its a bug, IMHO.
Comment #5
jhodgdonWe don't document any of the internal menu flags on hook_menu(), just the combinations. For instance, we list MENU_NORMAL_ITEM rather than the flags it's composed of: MENU_VISIBLE_IN_TREE and MENU_VISIBLE_IN_BREADCRUMB.
I think that is the right thing to do. There's a link provided to menu.inc so you can go read about all the other possible constants you could use to compose your own custom combinations if you wanted to, but the choices listed in hook_menu() cover the most common cases.
Regarding MENU_CALLBACK itself, its docblock says:
So I think everything is documented correctly.
Comment #6
jhodgdonremoving non-standard tag
Comment #7
droplet CreditAttribution: droplet commentedokay. I change title back, more people will search by MENU_CALLBACK + title.
MENU_CALLBACK in D7 is different to D6, not really sure if anyone can find the new change and use MENU_VISIBLE_IN_BREADCRUMB instead..
another bad thing is ......
if you set 'type' => MENU_NORMAL_ITEM first and then change to 'type' => MENU_CALLBACK, whatever you clear cache how many times.... the title still there (the title MENU_NORMAL_ITEM has set)
easy to overlook it (while API doesn't tell which is set title or not)
Comment #8
droplet CreditAttribution: droplet commentedComment #9
Dave Cohen CreditAttribution: Dave Cohen commentedIt's good to be in the know.
Comment #10
jhodgdonDave: You have taken what I said out of context.
If you think this needs more documentation, you can reopen and preferably add a patch showing what you'd like to be documented. The issue queue is a place for productive discussion, so you are free to disagree politely. :)
Comment #11
Dave Cohen CreditAttribution: Dave Cohen commentedI apologize. Sometimes online posts come across harsher than intended, and my comment #9 is one of those.
I was bounced from issue to issue before landing here. Its obviously something that a number of users have been surprised by, myself included. I was frustrated to spend time on it.
Anyway, I added a comment to the hook_menu() page on api.drupal.org. Maybe that will save others time.
Hopefully this comes across as polite... I think something documented as "internal", that is how MENU_VISIBLE_IN_BREADCRUMB is described, implies it is for use in Drupal code but not in contrib modules. I wouldn't expect "internal" values to behave the same from one version of Drupal to the next. On the other hand, I would expect the other types to remain the same. I'm curious if there was even a reason behind changing MENU_CALLBACK.
Comment #12
redben CreditAttribution: redben commentedSo, can we use MENU_VISIBLE_IN_BREADCRUMB or not since it is internal ?
Comment #13
droplet CreditAttribution: droplet commented#12,
you can use it on your module, MENU_VISIBLE_IN_BREADCRUMB is the default value in D6
Comment #14
Dave Cohen CreditAttribution: Dave Cohen commentedAccording the doc, MENU_NORMAL_ITEM is the default in D6, and remains the default in D7. The difference is that MENU_NORMAL_ITEM has changed.
MENU_VISIBLE_IN_BREADCRUMB belongs to a list of "flags for use in the type attribute of menu items". Whereas MENU_NORMAL_ITEM belongs to a list of "menu item types" meaning "item definitions provide one of these constants". Although the documentation is deemed correct, I personally understand why you would ask. My answer: you have to use it, if you want menu items to behave as they did in D6.
Comment #15
droplet CreditAttribution: droplet commentedyeah, right. I should have been a bit more clear on #13. As this thread talk about MENU_CALLBACK
which MENU_CALLBACK in D6 is
define('MENU_CALLBACK', MENU_VISIBLE_IN_BREADCRUMB);
and D7
define('MENU_CALLBACK', 0x0000);
Comment #16
mdshields CreditAttribution: mdshields commentedIs there simple documentation that just goes through each scenario:
1. document how to setup a menu that shows up in a navigation with a couple parents and some children, siblings, and sub-child
2. document how to setup a menu that shows up in main menu as siblings
3. document how to setup so that menu does not show up or shows up for specific events.
with propietary software, we need to know what you are thinking when this is created. I understand when this was all created there was so much to think about, but it seems the original thought is lost and now we are all left with millions of posted questions on what to do what where.
Comment #17
mdshields CreditAttribution: mdshields commentedI found the source of a lot of confusion with menu hook.
If you make any changes to your menu, only those changes get updated. The remainder of the menu items that were not changed are static in the database. WHich means, if you change a few elements around in your menu, everything will start looking garbled as the identifiers get mixed up since the database menu elements lost their position based on the identifiers that were previously in place.
Drupal needs a way to clear out all menu items whenever a menu hook is updated.
Comment #18
jsenich CreditAttribution: jsenich commentedIs this really intended functionality or is this related to this issue #965272: Items defined with type MENU_CALLBACK show "Home" as a title, which is very clearly a bug?
Comment #19
jsenich CreditAttribution: jsenich commentedDries committed a patch for #965272: Items defined with type MENU_CALLBACK show "Home" as a title which fixes the problem and brings back titles for MENU_CALLBACK items.