Hi all!

I need to import a lot of menu items with 2-3-4 nesting levels

I don't understand how to set parent in the CSV file and in the Feeds Mapping

Please help

Comments

ivnish created an issue. See original summary.

eugene bocharov’s picture

Same here. If anybody knows if it's possible please share.

megachriz’s picture

Title: Menu link parent » Add a FeedsTarget plugin for "menu_link_content:parent" to import hierachical menus
Category: Support request » Feature request

I've tried setup a feed type with the "Custom menu link" processor.

I also manually created a menu with a link and a child link. I inspected the child link with the Devel module and looked what the value for "parent" was:

[parent] => Array
(
  [x-default] => menu_link_content:92051065-e301-4d76-aa92-58ad8b1e9b20
)

So the first issue is that parent does not contain the ID of the parent menu link, but a string consisting of what seems to be the link's bundle (or subtype) and the parent menu link's UUID.

The Custom Menu Links module declares the property "parent" as a string:

$fields['parent'] = BaseFieldDefinition::create('string')
  ->setLabel(t('Parent plugin ID'))
  ->setDescription(t('The ID of the parent menu link plugin, or empty string when at the top level of the hierarchy.'));

This makes Feeds think it is just a simple text field with no special meaning. That's the second issue. The module has special cased this property and Feeds has no way of knowing that.

Long story short, importing a menu hierarchy with Feeds is not yet possible. To achieve this, a FeedsTarget plugin should be written especially for the menu link parent property.