You are here

public function ShortcutController::deleteShortcutLinkInline in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 43
Contains \Drupal\shortcut\Controller\ShortcutController.

Class

ShortcutController
Provides route responses for taxonomy.module.

Namespace

Drupal\shortcut\Controller

Code

public function deleteShortcutLinkInline(ShortcutInterface $shortcut) {
  $label = $shortcut
    ->label();
  try {
    $shortcut
      ->delete();
    drupal_set_message($this
      ->t('The shortcut %title has been deleted.', array(
      '%title' => $label,
    )));
  } catch (\Exception $e) {
    drupal_set_message($this
      ->t('Unable to delete the shortcut for %title.', array(
      '%title' => $label,
    )), 'error');
  }
  return $this
    ->redirect('<front>');
}