I was working on importing and exporting some nodes that had disabled menu items. The export code for those nodes was created as:
'menu' => array(
'link_title' => 'Disabled Menu',
'mlid' => 0,
'plid' => '1',
'menu_name' => 'primary-links',
'weight' => '0',
'options' => array(),
'module' => 'menu',
'expanded' => 0,
'hidden' => 0,
'has_children' => 0,
'customized' => 0,
'parent_depth_limit' => 8,
),
In this case, the menu link should actually have hidden = 1 since that represents a disabled link. Some other important things that don't get saved properly are expanded, has_children. Maybe customized and options?
After a little more review, it looks like if people have selected the "Import settings into node form first", this will not work since the menu settings will be lost (no fields for hidden, etc on the node edit form). However, if someone has selected the "Save as a new node then edit" it should work.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 516094-menu-settings-D6.patch | 1.29 KB | dave reid |
Comments
Comment #1
dave reidPatch attached for review. Note that this is not compatible with PHP 4 or 5.0.* because of the use of array_intersect_key, but it should be easy enough to fiddle with to work on PHP 4.
Comment #2
danielb commentedHmm does this cause any problems if you only export a single node from the menu heirarchy?
I'd rather rewrite it to use foreach or something if there are going to be compatibility issues.
Comment #3
danielb commentedI've updated the function like so, hope this is satisfactory.
Comment #5
ice5nake commentedI am losing the correct "Parent Item". This is because of the parent menu ids aren't in sync between my development, staging and production systems.
There's a lot of discussion about using uuids for menu links:
* UUIDs for Menu Links
* UUIDs for Menu Links?
* Add menu hook for linking to UUIDs
* Export Menu links with UUID