public function MenuController::addLink in Menu Item Extras 8.2
Provides the menu link creation form.
Parameters
\Drupal\system\MenuInterface $menu: An entity representing a custom menu.
Return value
array Returns the menu link creation form.
Deprecated
in 2.11 and is removed from 3.0.0. https://www.drupal.org/project/drupal/issues/2923429.
See also
https://www.drupal.org/project/drupal/issues/2923429
File
- src/
Controller/ MenuController.php, line 54
Class
- MenuController
- Defines a route controller for a form for menu link content entity creation.
Namespace
Drupal\menu_item_extras\ControllerCode
public function addLink(MenuInterface $menu) {
$menu_link = $this
->entityTypeManager()
->getStorage('menu_link_content')
->create([
'id' => '',
'parent' => '',
'menu_name' => $menu
->id(),
]);
return $this
->entityFormBuilder()
->getForm($menu_link);
}