InaccessibleMenuLink.php in Drupal 10
File
core/lib/Drupal/Core/Menu/InaccessibleMenuLink.php
View source
<?php
namespace Drupal\Core\Menu;
use Drupal\Component\Plugin\Exception\PluginException;
class InaccessibleMenuLink extends MenuLinkBase {
protected $wrappedLink;
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);
}
public function getTitle() {
return $this
->t('Inaccessible');
}
public function getDescription() {
return '';
}
public function getCacheContexts() {
return $this->wrappedLink
->getCacheContexts();
}
public function getCacheTags() {
return $this->wrappedLink
->getCacheTags();
}
public function getCacheMaxAge() {
return $this->wrappedLink
->getCacheMaxAge();
}
public function updateLink(array $new_definition_values, $persist) {
throw new PluginException('Inaccessible menu link plugins do not support updating');
}
}