You are here

public function ShortcutController::addForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/shortcut/src/Controller/ShortcutController.php \Drupal\shortcut\Controller\ShortcutController::addForm()

Returns a form to add a new shortcut to a given set.

Parameters

\Drupal\shortcut\ShortcutSetInterface $shortcut_set: The shortcut set this shortcut will be added to.

Return value

array The shortcut add form.

1 string reference to 'ShortcutController::addForm'
shortcut.routing.yml in core/modules/shortcut/shortcut.routing.yml
core/modules/shortcut/shortcut.routing.yml

File

core/modules/shortcut/src/Controller/ShortcutController.php, line 23

Class

ShortcutController
Provides route responses for taxonomy.module.

Namespace

Drupal\shortcut\Controller

Code

public function addForm(ShortcutSetInterface $shortcut_set) {
  $shortcut = $this
    ->entityTypeManager()
    ->getStorage('shortcut')
    ->create([
    'shortcut_set' => $shortcut_set
      ->id(),
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($shortcut, 'add');
}