diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php index 92e2185..870f6db 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php @@ -107,4 +107,34 @@ public function addShortcutLinkInline(ShortcutInterface $shortcut, Request $requ throw new AccessDeniedHttpException(); } + /** + * Form callback: builds the form for adding a new shortcut link. + * + * @param $form + * An associative array containing the structure of the form. + * @param $form_state + * An associative array containing the current state of the form. + * @param $shortcut_set Drupal\shortcut\Plugin\Core\Entity\Shortcut + * An object representing the shortcut set to which the link will be added. + * + * @return + * An array representing the form definition. + * + * @ingroup forms + * @see shortcut_link_edit_validate() + * @see shortcut_link_add_submit() + */ + function addShortcutLink($form, &$form_state, $shortcut_set) + { + drupal_set_title(t('Add new shortcut')); + $form['shortcut_set'] = array( + '#type' => 'value', + '#value' => $shortcut_set, + ); + $form += _shortcut_link_form_elements(); + return $form; + } + + + } diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc index a75c4e1..d960e64 100644 --- a/core/modules/shortcut/shortcut.admin.inc +++ b/core/modules/shortcut/shortcut.admin.inc @@ -180,33 +180,6 @@ function shortcut_set_add() { } /** - * Form callback: builds the form for adding a new shortcut link. - * - * @param $form - * An associative array containing the structure of the form. - * @param $form_state - * An associative array containing the current state of the form. - * @param $shortcut_set Drupal\shortcut\Plugin\Core\Entity\Shortcut - * An object representing the shortcut set to which the link will be added. - * - * @return - * An array representing the form definition. - * - * @ingroup forms - * @see shortcut_link_edit_validate() - * @see shortcut_link_add_submit() - */ -function shortcut_link_add($form, &$form_state, $shortcut_set) { - drupal_set_title(t('Add new shortcut')); - $form['shortcut_set'] = array( - '#type' => 'value', - '#value' => $shortcut_set, - ); - $form += _shortcut_link_form_elements(); - return $form; -} - -/** * Form callback: builds the form for editing a shortcut link. * * @param $form diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index c58bf8a..846ed15 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -118,12 +118,13 @@ function shortcut_menu() { ); $items['admin/config/user-interface/shortcut/manage/%shortcut_set/add-link'] = array( 'title' => 'Add shortcut', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('shortcut_link_add', 5), - 'access callback' => 'shortcut_set_edit_access', - 'access arguments' => array(5), + 'route_name' => 'shortcut_link_add', +// 'page callback' => 'drupal_get_form', +// 'page arguments' => array('shortcut_link_add', 5), +// 'access callback' => 'shortcut_set_edit_access', +// 'access arguments' => array(5), 'type' => MENU_LOCAL_ACTION, - 'file' => 'shortcut.admin.inc', +// 'file' => 'shortcut.admin.inc', ); $items['admin/config/user-interface/shortcut/link/%menu_link'] = array( 'title' => 'Edit shortcut', diff --git a/core/modules/shortcut/shortcut.routing.yml b/core/modules/shortcut/shortcut.routing.yml index dbd1376..3355356 100644 --- a/core/modules/shortcut/shortcut.routing.yml +++ b/core/modules/shortcut/shortcut.routing.yml @@ -1,3 +1,11 @@ +shortcut_link_add: + pattern: 'admin/config/user-interface/shortcut/manage/{shortcut_set}/add-link' + defaults: + _form: 'Drupal\shortcut\Form\LinkAdd' + _controller: 'Drupal\shortcut\Controller\ShortcutController::addShortcutLink' + requirements: + _access_shortcut_link_add: 'TRUE' + shortcut_link_delete: pattern: '/admin/config/user-interface/shortcut/link/{menu_link}/delete' defaults: