I have created a default content feature with nodes using the following node configuration:
- Node 1
-- Node 2
-- Node 3

However, after enabling this feature on a new site node 2 and 3 end up being on the same level with the menu root as its parent.
- Node 1
- Node 2
- Node 3

This same issue occurs on both 7.x-1.0-alpha6 and 7.x-2.x-dev branches. Has anyone else experienced this problem?

I will post updates if I find a result.

Comments

nick_schuch’s picture

Status: Active » Needs review
StatusFileSize
new750 bytes

This came down to the "Node 1" menu link not being saved first. We need to make sure that parents get saved first. To ensure this I have setup an import_sort in the menu_items plugin.

nick_schuch’s picture

Category: bug » feature
nick_schuch’s picture

I have also tested on 7.x-1.0-alpha6 and 7.x-2.x-dev branches.

populist’s picture

Status: Needs review » Reviewed & tested by the community

I tested this and it works great. Big improvement.

nick_schuch’s picture

StatusFileSize
new714 bytes

A slight update to the patch. The assigning of the variables without checking if they exist was throwing warning in my install profile.

populist’s picture

StatusFileSize
new714 bytes

Here is a clean re-roll of #5

populist’s picture

Status: Reviewed & tested by the community » Needs review

I am going to mark this back to needs review since I am seeing some inconsistency here with the usort and think we need some more reviews.

populist’s picture

I did more research here and here is an updated patch. I think my experience in #4 was more luck than actual logic. Changes:

  • Updated node_reference_import_sort() to make the logic use AND to evaluate options since both conditions are necessary to adjust the sort order.
  • Inverted the values (-1 and 1) in menu_item_import_sort() since we want to make the options with children be first (i.e, negative)
  • Added sort values from defaultcontent_import_sort() otherwise only the last value in the sort would have been relevant.

This is going to need some review, but hopefully this helps make ordering work a lot better.

Jeffrey C.’s picture

@populist: Can you confirm this patch is working on a clean install and solves the issue with no error derived from it?

Jeffrey C.’s picture

Title: Cannot import menu hierarchy of nodes. » Unable to Import Node with Menu Hierarchy
Version: 7.x-2.x-dev » 7.x-1.x-dev
Jeffrey C.’s picture

Title: Unable to Import Node with Menu Hierarchy » Unable to import nodes with menu hierarchy
Jeffrey C.’s picture

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

Dear all,

No features will be added to this module. Please check UUID Features Integration, a more flexible alternative. Check #1869366: Future Plan for more details.