This is not a bug report, but more of a "hmm, why is Drupal doing this?".
Hence, the support request category and DrupalWTF tag :)

Consider the following hook_menu:

<?php
  $items
['mymodule'] = array(
   
'title' => 'Menu link',
   
// Other obvious stuff
   
'menu_name' => 'navigation',
  );

 
$items['mymodule/%user'] = array(
   
'title' => 'Page title',
   
// Other obvious stuff
    // This causes the weird behavior when set to NULL or ''.
   
'menu_name' => '',
  );

 
$items['mymodule/%user/default'] = array(
   
'title' => "Default tab's title",
   
// Other obvious stuff...
   
'type' => MENU_DEFAULT_LOCAL_TASK,
  );

 
$items['mymodule/%user/nondefault'] = array(
   
'title' => "Second tab's title",
   
// Other obvious stuff...
   
'type' => MENU_LOCAL_TASK,
  );
?>

Now you get the following -unexpected- path vs page titles:

  • mymodule/1 => Page title
  • mymodule/1/nondefault => Menu link

When you change the hook_menu to add a different menu_name:

<?php
  $items
['mymodule/%user'] = array(
   
'title' => 'Page title',
   
// Other obvious stuff
    // A totally bogus name doesn't cause the behavior.
   
'menu_name' => 'thisdoesntevenexist',
  );
?>

You get the following expected path vs titles:

  • mymodule/1 => Page title
  • mymodule/1/nondefault => Page title

What's going on? ¯\(°_o)/¯
Am I missing something here?

Comments

kristiaanvandeneynde’s picture

Title:Page titles for non-default tabs act up, please explain why.» Page titles for non-default tabs act up when menu_name is empty or NULL, please explain why.
Priority:Normal» Minor

Clarified the first post.

Seems to me menu.inc doesn't recognize an item's parent (and thus skips its title) if that parent's menu_name is set to '' (empty string) or NULL.

kristiaanvandeneynde’s picture

Issue summary:View changes

Made the issue more clear.

kristiaanvandeneynde’s picture

Issue summary:View changes

Code cleanup