Hello

I recently updated my Drupal website from 7.7 to 7.9. Since this update, I noticed there is something wrong with the "available menu" filtering.

Steps to reproduce:
- Create a content-type with for example "available menus" filtering set to "Main Menu"
- Create a node for this type (notice that the "parent item"-list in the menu settings tab is filled correctly)
- Attach your node to "main menu"
- Save the node
- Edit this node again
- Notice that the "parent item" list in the menu settings tab is filled with all menus, not filtered by the "available menu" filtering.

If you save the node without attaching it to the menu, there is no problem.

I retested this in a clean Drupal 7.9 installation with no contrib modules...

Ozmodiar

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jvandooren’s picture

If I make the following change (menu.module line 617)...

<?php
//$options = menu_parent_options(menu_get_menus(), $link['mlid'] ? $link : $type);
$options = menu_parent_options(menu_get_menus(), $link, $type);
?>

My testcase does work... Maybe this helps.

Edit: changed node.module to menu.module offcourse, tnx Dooug

dooug’s picture

I experienced the same issue. I noticed the bug was not in node.module but menu.module. It appeared to me that $type should be passed in as the third argument (as in the patch mentioned above). I posted a patch. This worked for me.

dooug’s picture

New patch, it seems the menu_parent_options function expects $item to be the menu item id or $type. Although, this patch might be overkill, the first one should work.

Apparently the menu_parent_options function is known to be goofy:

<?php
// menu_parent_options() is goofy and can actually handle either a menu link
// or a node type both as second argument. Pick based on whether there is
// a link already (menu_node_prepare() sets mlid default to 0).
?>

http://api.drupal.org/api/drupal/modules--menu--menu.module/function/men...

figureone’s picture

Status: Active » Needs review

Changing the status so this patch gets tested. I applied it on my own system and it worked correctly. Thanks!

Version: 7.9 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.