You are here

public function OgMenuInstanceController::addLink in Organic Groups Menu (OG Menu) 8

Provides the menu link creation form.

Parameters

\Drupal\og_menu\OgMenuInstanceInterface $ogmenu_instance: An entity representing a custom menu.

Return value

array Returns the menu link creation form.

1 string reference to 'OgMenuInstanceController::addLink'
og_menu.routing.yml in ./og_menu.routing.yml
og_menu.routing.yml

File

src/Controller/OgMenuInstanceController.php, line 104
Contains Drupal\og_menu\Controller\OgMenuInstanceController.

Class

OgMenuInstanceController
Class OgMenuInstanceController.

Namespace

Drupal\og_menu\Controller

Code

public function addLink(OgMenuInstanceInterface $ogmenu_instance) {
  $menu_link = $this
    ->entityTypeManager()
    ->getStorage('menu_link_content')
    ->create(array(
    'id' => '',
    'parent' => '',
    'menu_name' => 'ogmenu-' . $ogmenu_instance
      ->id(),
    'bundle' => 'menu_link_content',
  ));
  return $this
    ->entityFormBuilder()
    ->getForm($menu_link);
}