Skip to content
Snippets Groups Projects
Commit b5b34b18 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #1978974 by plopesc: Convert shortcut_set_admin() to a Controller.

parent 6df1d3ad
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
<?php
/**
* @file
* Contains \Drupal\shortcut\Controller\ShortCutController.
*/
namespace Drupal\shortcut\Controller;
use Drupal\Core\ControllerInterface;
use Drupal\Core\Entity\EntityManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Builds the page for administering shortcut sets.
*/
class ShortcutController implements ControllerInterface {
/**
* Stores the entity manager.
*
* @var \Drupal\Core\Entity\EntityManager
*/
protected $entityManager;
/**
* Constructs a new \Drupal\shortcut\Controller\ShortCutController object.
*
* @param \Drupal\Core\Entity\EntityManager $entity_manager
* The entity manager.
*/
public function __construct(EntityManager $entity_manager) {
$this->entityManager = $entity_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('plugin.manager.entity'));
}
/**
* Presents a list of layouts.
*
* @return array
* An array as expected by drupal_render().
*/
public function shortcutSetAdmin() {
return $this->entityManager->getListController('shortcut')->render();
}
}
......@@ -170,13 +170,6 @@ function shortcut_set_switch_submit($form, &$form_state) {
shortcut_set_assign_user($set, $account);
}
/**
* Menu page callback: builds the page for administering shortcut sets.
*/
function shortcut_set_admin() {
return entity_list_controller('shortcut')->render();
}
/**
* Page callback: provides the shortcut set creation form.
*/
......
......@@ -64,9 +64,7 @@ function shortcut_menu() {
$items['admin/config/user-interface/shortcut'] = array(
'title' => 'Shortcuts',
'description' => 'Add and modify shortcut sets.',
'page callback' => 'shortcut_set_admin',
'access arguments' => array('administer shortcuts'),
'file' => 'shortcut.admin.inc',
'route_name' => 'shortcut_set_admin',
);
$items['admin/config/user-interface/shortcut/add-set'] = array(
'title' => 'Add shortcut set',
......
......@@ -11,3 +11,10 @@ shortcut_set_delete:
_form: 'Drupal\shortcut\Form\SetDelete'
requirements:
_entity_access: 'shortcut.delete'
shortcut_set_admin:
pattern: '/admin/config/user-interface/shortcut'
defaults:
_content: 'Drupal\shortcut\Controller\ShortcutController::shortcutSetAdmin'
requirements:
_permission: 'administer shortcuts'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment