Issue #2449743 by root_brute, tstoeckler: SwitchShortcutSet has an unnecessary dependency on the route match
parent
5cbaf8cca5
commit
f07bcffad6
|
@ -35,24 +35,14 @@ class SwitchShortcutSet extends FormBase {
|
||||||
*/
|
*/
|
||||||
protected $shortcutSetStorage;
|
protected $shortcutSetStorage;
|
||||||
|
|
||||||
/**
|
|
||||||
* The current route match.
|
|
||||||
*
|
|
||||||
* @var \Drupal\Core\Routing\RouteMatchInterface
|
|
||||||
*/
|
|
||||||
protected $routeMatch;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a SwitchShortcutSet object.
|
* Constructs a SwitchShortcutSet object.
|
||||||
*
|
*
|
||||||
* @param \Drupal\shortcut\ShortcutSetStorageInterface $shortcut_set_storage
|
* @param \Drupal\shortcut\ShortcutSetStorageInterface $shortcut_set_storage
|
||||||
* The shortcut set storage.
|
* The shortcut set storage.
|
||||||
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
|
|
||||||
* The current route match.
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ShortcutSetStorageInterface $shortcut_set_storage, RouteMatchInterface $route_match) {
|
public function __construct(ShortcutSetStorageInterface $shortcut_set_storage) {
|
||||||
$this->shortcutSetStorage = $shortcut_set_storage;
|
$this->shortcutSetStorage = $shortcut_set_storage;
|
||||||
$this->routeMatch = $route_match;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,8 +50,7 @@ class SwitchShortcutSet extends FormBase {
|
||||||
*/
|
*/
|
||||||
public static function create(ContainerInterface $container) {
|
public static function create(ContainerInterface $container) {
|
||||||
return new static(
|
return new static(
|
||||||
$container->get('entity.manager')->getStorage('shortcut_set'),
|
$container->get('entity.manager')->getStorage('shortcut_set')
|
||||||
$container->get('current_route_match')
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +185,7 @@ class SwitchShortcutSet extends FormBase {
|
||||||
$replacements = array(
|
$replacements = array(
|
||||||
'%user' => $this->user->label(),
|
'%user' => $this->user->label(),
|
||||||
'%set_name' => $set->label(),
|
'%set_name' => $set->label(),
|
||||||
'@switch-url' => $this->url($this->routeMatch->getRouteName(), array('user' => $this->user->id())),
|
'@switch-url' => $this->url('<current>'),
|
||||||
);
|
);
|
||||||
if ($account_is_user) {
|
if ($account_is_user) {
|
||||||
// Only administrators can create new shortcut sets, so we know they have
|
// Only administrators can create new shortcut sets, so we know they have
|
||||||
|
|
Loading…
Reference in New Issue