When I try to add certain user created menu links to a feature I can't I used the following process below. I don't understand how some menu links are exportable and others aren't even if they are all created the same way. Out of the two new menus I created I could only 1 link from each menu to the feature there are more than two links in the menus.

1. Create 2 new menus
2. Add menus to a feature
3. Add links to both menus (all pointing to <front> with various different titles)
4. Attempt to add menu links to existing feature
5. FAIL

Comments

mikebell_’s picture

Looks like when it generates the list of exportable menu links it's only taking the last items even though there are more available.

hefox’s picture

3. Add links to both menus (all pointing to with various different titles)

You're missing a word here

hefox’s picture

Issue summary: View changes

fixing

mikebell_’s picture

Fixed now I've had chance to calm down a bit, spend far too long messing around with my broken features trying to fix stuff that isn't going to work.

Easy steps to re-create:

1. Create new menu
2. Add 3 links (test 1, test 2, test 3), point them all to front
3. Create new feature, only test 3 link will be exportable (no need to save the feature)
4. Re-order new menu so test 2 is last in the list
5. Create new feature, only test 2 link will be exportable

I'll take a look through the code and see if I can patch it myself.

mikebell_’s picture

Got to the bottom of it.

When features builds up the array of $options in menu_links_features_export_options() it uses the $identifier as key for the array, this is generated from menu_links_features_identifier(). Since the menu name and the menu link path are the same in this case the $identifier will always be the same overwriting anything pre-existing in the $options array.

Simple you can't export multiple menu items that point to the same path in the same menu. Our use case for this is to create a dummy menu that can be used for theming purposes quickly and easily.

I'm pretty sure rebuilding how menu_links_features_identifier() works would break backwards compatibility. I'll leave this open in case anyone can offer a solution.

hefox’s picture

Status: Active » Closed (duplicate)
hefox’s picture

Issue summary: View changes

fixed code formatting.