blob: 1f163023596f270893b49dcec338e2a1a19a304e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<?php
namespace Drupal\Core\Menu;
use Drupal\Component\Plugin\Exception\PluginException;
/**
* A menu link plugin for wrapping another menu link, in sensitive situations.
*
* @see \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators::checkAccess()
*/
class InaccessibleMenuLink extends MenuLinkBase {
/**
* The wrapped menu link.
*
* @var \Drupal\Core\Menu\MenuLinkInterface
*/
protected $wrappedLink;
/**
* Constructs a new InaccessibleMenuLink.
*
* @param \Drupal\Core\Menu\MenuLinkInterface $wrapped_link
* The menu link to wrap.
*/
public function __construct(MenuLinkInterface $wrapped_link) {
$this->wrappedLink = $wrapped_link;
$plugin_definition = [
'route_name' => '<front>',
'route_parameters' => [],
'url' => NULL,
] + $this->wrappedLink->getPluginDefinition();
parent::__construct([], $this->wrappedLink->getPluginId(), $plugin_definition);
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this->t('Inaccessible');
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return '';
}
/**
* {@inheritdoc}
*/
public function getCacheContexts() {
return $this->wrappedLink->getCacheContexts();
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return $this->wrappedLink->getCacheTags();
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
return $this->wrappedLink->getCacheMaxAge();
}
/**
* {@inheritdoc}
*/
public function updateLink(array $new_definition_values, $persist) {
throw new PluginException('Inaccessible menu link plugins do not support updating');
}
}
|