diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php index 7410953..95802d8 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Core/Entity/Shortcut.php @@ -24,7 +24,8 @@ * "access" = "Drupal\shortcut\ShortcutAccessController", * "list" = "Drupal\shortcut\ShortcutListController", * "form" = { - * "default" = "Drupal\shortcut\ShortcutFormController" + * "default" = "Drupal\shortcut\ShortcutFormController", + * "edit" = "Drupal\shortcut\ShortcutFormController" * } * }, * config_prefix = "shortcut.set", diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php index b527b1f..c43fe14 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php @@ -20,7 +20,10 @@ class ShortcutAccessController extends EntityAccessController { * {@inheritdoc} */ protected function checkAccess(EntityInterface $entity, $operation, $langcode, User $account) { - if ($operation == 'delete') { + if ($operation == 'edit') { + return user_access('administer shortcuts', $account); + } + else if ($operation == 'delete') { if (!user_access('administer shortcuts', $account)) { return FALSE; } diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index c2c9b4a..69dbabb 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -89,12 +89,8 @@ function shortcut_menu() { ); $items['admin/config/user-interface/shortcut/manage/%shortcut_set/edit'] = array( 'title' => 'Edit set name', - 'page callback' => 'entity_get_form', - 'page arguments' => array(5), - 'access callback' => 'shortcut_set_edit_access', - 'access arguments' => array(5), + 'route_name' => 'shortcut_set_edit', 'type' => MENU_LOCAL_TASK, - 'file' => 'shortcut.admin.inc', 'weight' => 10, ); $items['admin/config/user-interface/shortcut/manage/%shortcut_set/delete'] = array( @@ -586,3 +582,15 @@ function shortcut_library_info() { return $libraries; } + +/** + * Implements hook_entity_info(). + */ +function shortcut_entity_info(&$entity_info) { + $entity_info['shortcut']['controllers'] += array( + 'list' => 'Drupal\shortcut\ShortcutListController', + 'form' => array( + 'edit' => 'Drupal\shortcut\ShortcutFormController', + ), + ); +} diff --git a/core/modules/shortcut/shortcut.routing.yml b/core/modules/shortcut/shortcut.routing.yml index 488d187..761067f 100644 --- a/core/modules/shortcut/shortcut.routing.yml +++ b/core/modules/shortcut/shortcut.routing.yml @@ -18,3 +18,9 @@ shortcut_set_admin: _content: 'Drupal\shortcut\Controller\ShortcutController::shortcutSetAdmin' requirements: _permission: 'administer shortcuts' +shortcut_set_edit: + pattern: '/admin/config/user-interface/shortcut/manage/{shortcut}/edit' + defaults: + _entity_form: 'shortcut.edit' + requirements: + _entity_access: 'shortcut.edit'