function ShortcutController::deleteShortcutLinkInline
Same name in other branches
- 9 core/modules/shortcut/src/Controller/ShortcutController.php \Drupal\shortcut\Controller\ShortcutController::deleteShortcutLinkInline()
- 8.9.x core/modules/shortcut/src/Controller/ShortcutController.php \Drupal\shortcut\Controller\ShortcutController::deleteShortcutLinkInline()
- 10 core/modules/shortcut/src/Controller/ShortcutController.php \Drupal\shortcut\Controller\ShortcutController::deleteShortcutLinkInline()
Deletes the selected shortcut.
Parameters
\Drupal\shortcut\ShortcutInterface $shortcut: The shortcut to delete.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse A redirect to the previous location or the front page when destination is not set.
1 string reference to 'ShortcutController::deleteShortcutLinkInline'
- 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 38
Class
- ShortcutController
- Provides route responses for taxonomy.module.
Namespace
Drupal\shortcut\ControllerCode
public function deleteShortcutLinkInline(ShortcutInterface $shortcut) {
$label = $shortcut->label();
try {
$shortcut->delete();
$this->messenger()
->addStatus($this->t('The shortcut %title has been deleted.', [
'%title' => $label,
]));
} catch (\Exception) {
$this->messenger()
->addStatus($this->t('Unable to delete the shortcut for %title.', [
'%title' => $label,
]), 'error');
}
return $this->redirect('<front>');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.