I recently ran into this issue #927566: Add link title to menu link identifiers to make them more unique. on a project and solved it by generating UUIDs for each menu link and using them as the export keys. It's a small module so I thought it might be better to have it as a sub module of this project rather than creating a separate one for just it. Let me know if you guys would like to take it on board.

The module also touches on #968826: Export Menu links with UUID but solves the issue in a slightly different way. It looks at the menu router each menu link path uses and if the router path has node_load or user_load defined as an auto loader function for one of the arguments the nid or uid for that argument is switched out for the uuid. During import the opposite happens. This seemed like a nice quick fix which will cover most cases until http://drupal.org/project/uuid_resolver is more mature.

Finally this module also includes my fix for #935152: Menu Items missing from Menu Links due to access callback user_is_anonymous so it can be used to export all menu items in all situations.

This code was developed for Fujitsu by BrightLemon Ltd. Thanks go to both for allowing me to release it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patcon’s picture

Hey there -- haven't been able to review patch, but was directed here from another issue I was following, so thought I'd point you here:
http://drupal.org/project/issues/features?text=menu&status=All

There's been tons of discussion about this in the Features issue queue, as you can see from the top posts that have 20-35 posts. There's some cross-references back to uuid and uuid_features, but I think there's still some roadblocks in terms of making this work (since menus have very few things that are guaranteed unique and consistent, if I understand correctly). Anyhow, might want to direct people here for exposure :)

jlstrecker’s picture

Dean Reilly, thanks for providing this patch. It was a huge help.

Since it wasn't immediately obvious how to use it (at least not to me!), here are a few instructions--

  1. Enable the UUID Features - Menus submodule created by the patch.
  2. Admin > Structure > Features > Generate UUIDs for Menu Items
  3. Create feature with menu_uuid_links checkboxes (not menu_links).
iArnaud’s picture

Hey there,

I had some difficulties to export nodes & menus links for a multilangual site (many domains).

So this patch helped a lot but some stuffs didn't work as I expected so I recreate a patch that include uuid_features_menu.patch with my improvments.

Hope it will help.

Cheers.

gabriel.achille’s picture

subscribing
It seems to me that this could be a relative long term solution. thanks
I tested it: so far so good.
Just one question: @Dean: why did you choose to add the extra field (uuid) to menu_links table instead of creating a specific table like uuid_node ?

greggles’s picture

Status: Active » Needs review

There's stuff here, so it needs review.

ahlofan’s picture

Any solution for d7?

JvE’s picture

Thanks for this work Dean.
I created a sandbox here with a kind of D7 port.
One without UUID integration or dependecy though. It's only meant to solve the problem with duplicate menu items not exporting.

Status: Needs review » Needs work

The last submitted patch, uuid_features_menu_i18n.patch, failed testing.

jrao’s picture

Issue summary: View changes
FileSize
5.45 KB

Here's a port of the original D6 module to D7.

uuid_features_menu.patch queued for re-testing.

saltednut’s picture

Hey all, I think this needs to be its own project. It seems to have a specific use case outside of what UUID Features means to solve. I actually ran into this problem recently with a demo I was building where we needed all the links on the top nav to just go to 'home' and I was unable to export the links because they all had the same path. My workaround was to allow the home page panel to take an optional argument and make the links go to paths like /home/news or /home/multimedia.

Anyway, I think this is a nice little module and it deserves to have its own space in the Drupal world. Not every module has to have a major, lifechanging scope. I am going to close this issue as (won't fix) but I encourage all who are interested in making this into a real module.

saltednut’s picture

Status: Needs work » Closed (won't fix)
ioskevich’s picture

Added Taxonomy Terms support for module from #9 and created a sandbox project: https://drupal.org/sandbox/ioskevich/2163429

@jrao: couldn't find your module as a project at Drupal.org (github only) - if you have this project at Drupal.org already, please let me know - I will remove sandbox and will provide my changes as a patch to your project.

jrao’s picture

@ioskevich: No, it's not a project at drupal.org, feel free to promote your sandbox to a full project.