You are here

public function GroupContentMenuController::addLink in Group Content Menu 8

Provides the menu link creation form.

Parameters

\Drupal\group_content_menu\GroupContentMenuInterface $group_content_menu: An entity representing a custom menu.

Return value

array Returns the menu link creation form.

File

src/Controller/GroupContentMenuController.php, line 165

Class

GroupContentMenuController
Returns responses for 'group_content_menu' GroupContent routes.

Namespace

Drupal\group_content_menu\Controller

Code

public function addLink(GroupContentMenuInterface $group_content_menu) {
  $menu_name = GroupContentMenuInterface::MENU_PREFIX . $group_content_menu
    ->id();
  $menu_link = $this
    ->entityTypeManager()
    ->getStorage('menu_link_content')
    ->create([
    'menu_name' => $menu_name,
    'bundle' => 'menu_link_content',
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($menu_link);
}