You are here

public function LinkController::addForm in Colossal Menu 8

Same name and namespace in other branches
  1. 2.x src/Controller/LinkController.php \Drupal\colossal_menu\Controller\LinkController::addForm()

Add new Link form.

Presents the creation form for colossal_menu_link entities of given bundle/type.

Parameters

\Drupal\system\MenuInterface $colossal_menu: An entity representing a custom menu.

\Drupal\Core\Entity\EntityInterface $colossal_menu_link_type: The custom bundle to add.

\Symfony\Component\HttpFoundation\Request $request: The current request object.

Return value

array A form array as expected by drupal_render().

1 call to LinkController::addForm()
LinkController::add in src/Controller/LinkController.php
Add new Link page.
1 string reference to 'LinkController::addForm'
colossal_menu.routing.yml in ./colossal_menu.routing.yml
colossal_menu.routing.yml

File

src/Controller/LinkController.php, line 151

Class

LinkController
Class LinkAddController.

Namespace

Drupal\colossal_menu\Controller

Code

public function addForm(MenuInterface $colossal_menu, EntityInterface $colossal_menu_link_type, Request $request) {
  $entity = $this->storage
    ->create([
    'type' => $colossal_menu_link_type
      ->id(),
    'menu' => $colossal_menu,
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($entity);
}