Issue #1978952 by vijaycs85, vyasamit2007, tim.plunkett: Convert shortcut_set_add() to a Controller.
parent
27f8cd4cd6
commit
522c787ef2
|
@ -21,6 +21,7 @@ class ShortcutAccessController extends EntityAccessController {
|
|||
*/
|
||||
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
|
||||
switch ($operation) {
|
||||
case 'create':
|
||||
case 'update':
|
||||
if (user_access('administer shortcuts', $account)) {
|
||||
return TRUE;
|
||||
|
|
|
@ -171,14 +171,6 @@ function shortcut_set_switch_submit($form, &$form_state) {
|
|||
shortcut_set_assign_user($set, $account);
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback: provides the shortcut set creation form.
|
||||
*/
|
||||
function shortcut_set_add() {
|
||||
$entity = entity_create('shortcut', array());
|
||||
return Drupal::entityManager()->getForm($entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Form callback: builds the form for adding a new shortcut link.
|
||||
*
|
||||
|
|
|
@ -91,10 +91,8 @@ function shortcut_menu() {
|
|||
);
|
||||
$items['admin/config/user-interface/shortcut/add-set'] = array(
|
||||
'title' => 'Add shortcut set',
|
||||
'page callback' => 'shortcut_set_add',
|
||||
'access arguments' => array('administer shortcuts'),
|
||||
'type' => MENU_LOCAL_ACTION,
|
||||
'file' => 'shortcut.admin.inc',
|
||||
'route_name' => 'shortcut_set_add',
|
||||
'type' => MENU_SIBLING_LOCAL_TASK,
|
||||
);
|
||||
$items['admin/config/user-interface/shortcut/manage/%shortcut_set'] = array(
|
||||
'title' => 'Edit shortcuts',
|
||||
|
@ -576,3 +574,18 @@ function shortcut_library_info() {
|
|||
|
||||
return $libraries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_local_actions.
|
||||
*/
|
||||
function shortcut_local_actions() {
|
||||
return array(
|
||||
array(
|
||||
'route_name' => 'shortcut_set_add',
|
||||
'title' => t('Add shortcut set'),
|
||||
'appears_on' => array(
|
||||
'shortcut_set_admin',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,13 @@ shortcut_set_admin:
|
|||
requirements:
|
||||
_permission: 'administer shortcuts'
|
||||
|
||||
shortcut_set_add:
|
||||
pattern: '/admin/config/user-interface/shortcut/add-set'
|
||||
defaults:
|
||||
_entity_form: 'shortcut.add'
|
||||
requirements:
|
||||
_entity_create_access: 'shortcut'
|
||||
|
||||
shortcut_set_edit:
|
||||
pattern: '/admin/config/user-interface/shortcut/manage/{shortcut}/edit'
|
||||
defaults:
|
||||
|
|
Loading…
Reference in New Issue