I am really excited about this module, I was looking for exactly this for my own installation profiles.

There is a problem I'm experiencing though, my feature containing nodes fails to promote the correct content to the homepage and it does not create menu items although these settings are in the feature's code.

I also had in instance where, after running the profile where my 'content feature module' implemented pages, the content was there but the content type 'page' was not. So the website did have page nodes, but not the content type page....

Would greatly appreciate any help or suggestions!

Update 2020

There is a new module Feature Menu UUID which adds a uuid to every menu link in the database, and then uses those for the export.

It also converts entity paths into uuid paths on export, using the uuid of the entity.

All future effort about menu links integration should go into this new module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AlfTheCat’s picture

Title: Node promotion and menu settings not working » Node ID's are not preserved, breaking menu links and other node references.

I just found out (it completely slipped past me) that the reason for my problem is that... the node id's are not kept in tact.

So I export a node/96 in my feature module.... but it arrives as node/2. So that's why my content references and menus break down.

Changing the title, I hope this info can provide any suggestions.

chaps2’s picture

This module is not supposed to preserve node ids - and it wouldn't work if it did.

So although I haven't tried exporting nodes yet, i doubt this is a bug.

indytechcook’s picture

Title: Node ID's are not preserved, breaking menu links and other node references. » Export Menu links with UUID
Category: bug » feature

Node id's are a serial id from the node table and can not be used across multiple sites. Preservice nid's is not the answer. Perhaps exporting menu links against the UUID would be an anser.

AlfTheCat’s picture

Perhaps exporting menu links against the UUID would be an anser.

Thanks for the reply, what exactly do you mean by exporting menu's against the UUID? Is this different from what I'm doing now, just selecting items and nodes from the 'Menu's' , 'Menu links' and 'Content' options when creating a feature?

indytechcook’s picture

So this module works by creating a UUID for the node using the UUID module. The UUID is unique per site, it's considered a GUID. We just need to create a patch that modifies the menu links as they are being exported, replacing the nid with a uuid for paths like 'node/[nid]'.

pearcec’s picture

This is a show stopper for us at the moment. I think the whole point of having this in a feature is that you would expect it to link to a menu somewhere. Otherwise you just have content floating on in the abyss. I would like to help. Seems like we would have to patch the features module. It should check if uuid is being used. If so export the uuid. Then when we don the import it needs to do the translation. Doesn't sound to bad.

pearcec’s picture

Status: Active » Needs work
FileSize
4.91 KB

I tried to work on a patch. I modified features/includes/features.menu.inc. Might not be the best approach. It works but the content needs to be in place before the menu_link can be loaded. Otherwise the feature will show that it is overridden until the menu_link can be reverted. The only way to fix this would be to make uuid_content features get loaded before menu_links.

pearcec’s picture

this patch is broken, I was working on it late and didn't upload the correct one. Looking for it now.

pearcec’s picture

FileSize
2.79 KB

Found it.

dkingofpa’s picture

Patch from #9 with a fix so duplicate menu links aren't inadvertently created. It patches the features module.

ezra-g’s picture

Project: UUID Features Integration » Features
Status: Needs work » Needs review

This is a patch against the Features module - Moving to the proper queue and reviewing today.

Here's some background on why I'm interested in this patch:

Goal: Export menu links that match a defined sitemap for the Conference Organizing Distribution (COD).

Challenge: We want to point to both arbitrary callbacks and Views based on their path alias. However, the nids of these node changes across sites.

For example, Looking at a slice of our primary links, we want:
/schedule (points to a node created during .install or exported by UUID Features )
/schedule/sessions (points to a view defined in a feature)

ezra-g’s picture

Here's a slight re-roll with

-    if (!$existing || in_array($link, $menu_links)) {
+    if (!$existing || !empty($menu_links[$identifier])) {

This conditional was preventing certain menu links from being saved. Specifically, the links that were not being saved were menu links pointing to a page view that was a child of a node+ menu link combo exported by uuid. The conditional was failing because the menu link in code refers to a parent uuid, which earlier in this function we change to the actual parent_path. Because the altered $link no longer matched the one passed in with $menu_links, it was never saved.

Note that this depends on the patch at http://drupal.org/node/860974#comment-3505484 .

dsnopek’s picture

Subscribe

Transmitter’s picture

This patch works great!

But say .. is it possible, that it doesn't take care of the second level menu/hierachy?

Now, every node and menu link shows up for the parent pages.
Just the child pages menu links don't show up.

I tried to grasp the problem within 968826-features-menu-uuid.patch but somehow I am a bit rusty I guess :-S

thebuckst0p’s picture

subscribe

scottrigby’s picture

@ezra-g - #12 (& dependent patch) seems to be working like a charm. Exact same use case, for deployment.

ywarnier’s picture

subscribe

scottrigby’s picture

Status: Needs review » Needs work

re #12: just noticed node_get_by_uuid() is now called a few times without checking if module_exists('uuid')

tayzlor’s picture

added module_exists() check for the one part of the patch it is needed at. re-uploading.

ezra-g’s picture

Status: Needs work » Needs review

Marking as needs review per #19.

Matir’s picture

The patch in #19 has a couple of obvious problems even before I apply it. It blindly assumes that the link_path is an internal Drupal link to a node (e.g., node/NNNN). Linking to anything else (a view, a module-generated page, an external link) would try to pull a node out of who-knows-what. Additionally, it blindly assumes that there is a $node->uuid, without checking if it exists. While the next check will catch it, this will throw a PHP warning on a node without a uuid.

AndyF’s picture

subscribe

hefox’s picture

Status: Needs review » Needs work

Looked at it also and saw what 21 saw, so needs work.

Moving most major feature requests to d7; is this relavent for d7?

Dean Reilly’s picture

Subscribed

okokokok’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Very relevant for D7.

Dean Reilly’s picture

I ran into this issue on a recent project and ended up coding my own solution for the 6.x branch. I've created an issue for it in the features uuid issue queue here #1283742: UUIDs for Menu Links.

My solution worked by looking for node and user auto load functions in menu router paths and switching out the arguments for their respective UUIDs.

greggles’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev

Since the work so far is against 6.x it seems reasonable to leave this as 6.x unless a maintainer comments to say they want to follow the "fix in 7.x, backport" flow instead of a "fix in 6.x, forward port" flow.

hefox’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

The policy for features is that feature requests cannot go directly into 6.x without going into 7.x first (unless they are irrelevant to 7.x) :/

greggles’s picture

No problem - great to have that direction.

ygerasimov’s picture

I would suggest this functionality to live in uuid_features module instead of features itself.

imre.horjan’s picture

Issue summary: View changes

I have written a patch for Features 2: https://www.drupal.org/node/2353585

donquixote’s picture

Status: Needs work » Closed (duplicate)

This was already "fixed" in #2353585: UUID export and import of menu items linking to nodes, terms and users.
The solution that was committed is far from perfect, but it does make this old issue obsolete.
Closing as duplicate.

donquixote’s picture

Issue summary: View changes

Adding a link to the new Feature Menu UUID module.