public function MenuController::addLink in Drupal 9
Same name and namespace in other branches
- 8 core/modules/menu_link_content/src/Controller/MenuController.php \Drupal\menu_link_content\Controller\MenuController::addLink()
- 10 core/modules/menu_link_content/src/Controller/MenuController.php \Drupal\menu_link_content\Controller\MenuController::addLink()
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.
1 string reference to 'MenuController::addLink'
- menu_link_content.routing.yml in core/
modules/ menu_link_content/ menu_link_content.routing.yml - core/modules/menu_link_content/menu_link_content.routing.yml
File
- core/
modules/ menu_link_content/ src/ Controller/ MenuController.php, line 22
Class
- MenuController
- Defines a route controller for a form for menu link content entity creation.
Namespace
Drupal\menu_link_content\ControllerCode
public function addLink(MenuInterface $menu) {
$menu_link = $this
->entityTypeManager()
->getStorage('menu_link_content')
->create([
'menu_name' => $menu
->id(),
]);
return $this
->entityFormBuilder()
->getForm($menu_link);
}