function MenuController::addLink
Same name in other branches
- 9 core/modules/menu_link_content/src/Controller/MenuController.php \Drupal\menu_link_content\Controller\MenuController::addLink()
- 8.9.x core/modules/menu_link_content/src/Controller/MenuController.php \Drupal\menu_link_content\Controller\MenuController::addLink()
- 11.x 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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.