You are here

public function MenuController::addLink in Config menu link 8

Provides the config 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_config.routing.yml in ./menu_link_config.routing.yml
menu_link_config.routing.yml

File

src/Controller/MenuController.php, line 24
Contains \Drupal\menu_link_config\Controller\MenuController.

Class

MenuController

Namespace

Drupal\menu_link_config\Controller

Code

public function addLink(MenuInterface $menu) {
  $menu_link = $this
    ->entityTypeManager()
    ->getStorage('menu_link_config')
    ->create([
    'id' => '',
    'parent' => '',
    'menu_name' => $menu
      ->id(),
    'bundle' => 'menu_link_config',
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($menu_link);
}