function ShortcutController::addForm

Same name in other branches
  1. 8.9.x core/modules/shortcut/src/Controller/ShortcutController.php \Drupal\shortcut\Controller\ShortcutController::addForm()
  2. 10 core/modules/shortcut/src/Controller/ShortcutController.php \Drupal\shortcut\Controller\ShortcutController::addForm()
  3. 11.x 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.