- Issue created by @jnicola
We are migrating a monolithic menu to group_content_menu. Group content entities have a menu_link field on them. They were originally pointing to menu items in the monolothic menu, they now need to point to the migrated group_content_menu menu_link items.
I'm trying to set the menu link fields on any group content entity to the first menu link field in their group_content_menu that matches the group content entity route, but it is instead creating duplicate links.
This is roughly what i am up to:
// @todo This code is causing double menu items!
$menu_item_values = [
'title' => $menu_tree_item->link->getTitle(),
'description' => $menu_tree_item->link->getDescription(),
'parent' => $menu_tree_item->link->getParent(),
'menu_name' => $menu_tree_item->link->getMenuName(),
'weight' => $menu_tree_item->link->getWeight(),
];
$group_content->set(group_content_submenu_group_content_menu_field(), $menu_item_values);
$group_content->save();
Active
2.0
Documentation