Reproduce: Have a default menu link exported from features with a parent that is added via hook_menu (for example) and not hook_menu_default_menu_links.

Since this doesn't test if menu item is managed by a feature.

if (!empty($link['plid']) && $parent = menu_link_load($link['plid'])) {
  $link['parent_path'] = $parent['link_path'];
}

When menu_links_features_rebuild_ordered is reordering, it drops the menu item as both conditions always fail.

Patch tests and lets it catch the first if statement. Later, if the menu item exists, even if not managed by features, it sets the parent as features_menu_link_load doesn't care who made the menu link :)!.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hefox’s picture

Title: parent_path set to links not managed by features causes menu link to not revert » parent_path set to path not in hook_menu_default_menu_links causes menu link to not revert

Clarifying title

jhedstrom’s picture

FileSize
740 bytes

This resolves the issue for me. Re-uploading the same patch, but made with --relative --no-prefix so it can be applied via drush make.

hefox’s picture

Status: Needs review » Reviewed & tested by the community

Seems good then, marking RTBC.

(Oh damn, I've been sooo good lately about --relative --no-prefix I haven't been double checking my patches. I really need to make an alias...).

DamienMcKenna’s picture

+1. This, and a few others, have resolved some crazy menu problems I was having. Thanks!

hefox’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
hefox’s picture

Status: Patch (to be ported) » Needs review
FileSize
748 bytes

Patch applied fine, so here's one with the a/, b/ prefixes.

febbraro’s picture

Assigned: Unassigned » febbraro
febbraro’s picture

I'm having difficultly testing this. Can you give me a more complete test case?

hefox’s picture

1) Take a menu item that is in a menu by default, like create content (node/add) in navigation.
2) Add a menu entity under that to something else ('admin/content/node'? for example)
3) export that menu link into a feature.
4) try that feature on a new site

(I think)

mpotter’s picture

Status: Needs review » Closed (won't fix)

Closing this for lack of activity. I know menu links have issues, but please re-open this issue if you think this patch is still needed.