diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Access/SwitchShortcutSetAccessCheck.php b/core/modules/shortcut/lib/Drupal/shortcut/Access/SwitchShortcutSetAccessCheck.php index db22e24..02dff71 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Access/SwitchShortcutSetAccessCheck.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Access/SwitchShortcutSetAccessCheck.php @@ -28,6 +28,7 @@ class SwitchShortcutSetAccessCheck implements StaticAccessCheckInterface { * Constructs a new SwitchShortcutSetAccessCheck. * * @param \Drupal\Core\Session\AccountInterface $account + * The current user. */ public function __construct($account) { $this->account = $account; @@ -37,7 +38,6 @@ public function __construct($account) { * {@inheritdoc} */ public function appliesTo() { - // TODO: Implement appliesTo() method. return array('_shortcut_set_switch'); } diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Form/SwitchShortcutSet.php b/core/modules/shortcut/lib/Drupal/shortcut/Form/SwitchShortcutSet.php index 447b2f7..44eb1c5 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Form/SwitchShortcutSet.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Form/SwitchShortcutSet.php @@ -38,13 +38,6 @@ class SwitchShortcutSet extends FormBase implements ContainerInjectionInterface, protected $storageController; /** - * The user storage controller. - * - * @var \Drupal\user\UserStorageControllerInterface - */ - protected $userStorageController; - - /** * The url generator. * * @var \Drupal\Core\Routing\UrlGeneratorInterface @@ -57,11 +50,10 @@ class SwitchShortcutSet extends FormBase implements ContainerInjectionInterface, * @param \Drupal\Core\Entity\EntityManager $entity_manager * The entity manager. * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator - * The url generator + * The url generator. */ public function __construct(EntityManager $entity_manager, UrlGeneratorInterface $url_generator) { $this->storageController = $entity_manager->getStorageController('shortcut_set'); - $this->userStorageController = $entity_manager->getStorageController('user'); $this->urlGenerator = $url_generator; } @@ -88,7 +80,7 @@ public function getFormID() { public function buildForm(array $form, array &$form_state, UserInterface $user = NULL) { $account = $this->getRequest()->attributes->get('_account'); - $this->user = $this->userStorageController->load($user->id()); + $this->user = $user; // Prepare the list of shortcut sets. $options = array_map(function ($set) { @@ -196,7 +188,7 @@ public function submitForm(array &$form, array &$form_state) { $replacements = array( '%user' => $this->user->label(), '%set_name' => $set->label(), - '@switch-url' => $this->urlGenerator->generateFromPath($this->request->attributes->get('system_path')), + '@switch-url' => $this->urlGenerator->generateFromPath($this->request->attributes->get('_system_path')), ); if ($account_is_user) { // Only administrators can create new shortcut sets, so we know they have diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageController.php index ac46be6..f28f086 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageController.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageController.php @@ -41,7 +41,7 @@ class ShortcutSetStorageController extends ConfigStorageController implements Sh * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory * The entity query factory. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler; + * The module handler. */ public function __construct($entity_type, array $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, ModuleHandlerInterface $module_handler) { parent::__construct($entity_type, $entity_info, $config_factory, $config_storage, $entity_query_factory); diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageControllerInterface.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageControllerInterface.php index 9cd4f7a..ab1e1eb 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageControllerInterface.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageControllerInterface.php @@ -77,7 +77,7 @@ public function countAssignedUsers(ShortcutSetInterface $shortcut_set); * @param \Drupal\Core\Session\AccountInterface $account * The user account whose default shortcut set will be returned. * - * @return + * @return \Drupal\shortcut\ShortcutSetInterface * An object representing the default shortcut set. */ public function getDefaultSet(AccountInterface $account); diff --git a/core/modules/shortcut/shortcut.routing.yml b/core/modules/shortcut/shortcut.routing.yml index de0b666..dd70653 100644 --- a/core/modules/shortcut/shortcut.routing.yml +++ b/core/modules/shortcut/shortcut.routing.yml @@ -36,7 +36,7 @@ shortcut_set_edit: shortcut_set_switch: pattern: '/user/{user}/shortcuts' defaults: - _form: 'Drupal\shortcut\Form\SetSwitch' + _form: 'Drupal\shortcut\Form\SwitchShortcutSet' requirements: _permission: 'administer shortcuts' _shortcut_set_switch: 'TRUE' diff --git a/core/modules/shortcut/shortcut.services.yml b/core/modules/shortcut/shortcut.services.yml index 7d8301a..94ed2c1 100644 --- a/core/modules/shortcut/shortcut.services.yml +++ b/core/modules/shortcut/shortcut.services.yml @@ -4,7 +4,7 @@ services: tags: - { name: access_check } access_check.shortcut.switch: - class: Drupal\shortcut\Access\SetSwitchAccessCheck + class: Drupal\shortcut\Access\SwitchShortcutSetAccessCheck arguments: ['@current_user'] tags: - { name: access_check }