X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fshortcut%2Fsrc%2FController%2FShortcutController.php;fp=web%2Fcore%2Fmodules%2Fshortcut%2Fsrc%2FController%2FShortcutController.php;h=4f33b0b555737fb5b15545047313e624e577f76d;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/shortcut/src/Controller/ShortcutController.php b/web/core/modules/shortcut/src/Controller/ShortcutController.php new file mode 100644 index 000000000..4f33b0b55 --- /dev/null +++ b/web/core/modules/shortcut/src/Controller/ShortcutController.php @@ -0,0 +1,52 @@ +entityManager()->getStorage('shortcut')->create(['shortcut_set' => $shortcut_set->id()]); + return $this->entityFormBuilder()->getForm($shortcut, 'add'); + } + + /** + * Deletes the selected shortcut. + * + * @param \Drupal\shortcut\ShortcutInterface $shortcut + * The shortcut to delete. + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + * A redirect to the previous location or the front page when destination + * is not set. + */ + public function deleteShortcutLinkInline(ShortcutInterface $shortcut) { + $label = $shortcut->label(); + + try { + $shortcut->delete(); + drupal_set_message($this->t('The shortcut %title has been deleted.', ['%title' => $label])); + } + catch (\Exception $e) { + drupal_set_message($this->t('Unable to delete the shortcut for %title.', ['%title' => $label]), 'error'); + } + + return $this->redirect(''); + } + +}