InaccessibleMenuLink
class InaccessibleMenuLink extends MenuLinkBase (View source)
A menu link plugin for wrapping another menu link, in sensitive situations.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Provides dependency injection friendly methods for serialization.
Provides a trait for the messenger service.
Constants
| DERIVATIVE_SEPARATOR |
A string which is used to separate base plugin IDs from the derivative ID. |
Properties
| protected string | $pluginId | The plugin_id. |
from PluginBase |
| protected array | $pluginDefinition | The plugin implementation definition. |
from PluginBase |
| protected array | $configuration | Configuration information passed into the plugin. |
from PluginBase |
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected MessengerInterface | $messenger | The messenger. |
from MessengerTrait |
| protected array | $overrideAllowed | The list of definition values where an override is allowed. |
from MenuLinkBase |
| protected MenuLinkInterface | $wrappedLink | The wrapped menu link. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Returns the plugin ID of the menu link's parent, or an empty string.
Returns a URL object containing either the external path or route.
Returns the name of a class that can build an editing form for this link.
Returns route information for a route to delete the menu link.
Returns route information for a custom edit form for the menu link.
Returns route information for a route to translate the menu link.
The maximum age for which this object may be cached.
The cache contexts associated with this object.
The cache tags associated with this object.
Returns the localized title to be shown for this link.
Returns the description of the menu link.
Updates the definition values for a menu link.
Details
__construct(MenuLinkInterface $wrapped_link)
Constructs a new InaccessibleMenuLink.
string
getPluginId()
Gets the plugin_id of the plugin instance.
string
getBaseId()
Gets the base_plugin_id of the plugin instance.
string|null
getDerivativeId()
Gets the derivative_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
bool
isConfigurable()
Determines if the plugin is configurable.
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
setMessenger(MessengerInterface $messenger)
Sets the messenger.
MessengerInterface
messenger()
Gets the messenger.
int
getWeight()
Returns the weight of the menu link.
string
getMenuName()
Returns the menu name of the menu link.
string
getProvider()
Returns the provider (module name) of the menu link.
string
getParent()
Returns the plugin ID of the menu link's parent, or an empty string.
bool
isEnabled()
Returns whether the menu link is enabled (not hidden).
bool
isExpanded()
Returns whether the child menu links should always been shown.
bool
isResettable()
Returns whether this link can be reset.
In general, only links that store overrides using the menu_link.static.overrides service should return TRUE for this method.
bool
isTranslatable()
Returns whether this link can be translated.
bool
isDeletable()
Returns whether this link can be deleted.
array
getOptions()
Returns the options for this link.
array
getMetaData()
Returns any metadata for this link.
string
getRouteName()
Returns the route name, if available.
array
getRouteParameters()
Returns the route parameters, if available.
Url
getUrlObject(bool $title_attribute = TRUE)
Returns a URL object containing either the external path or route.
string
getFormClass()
Returns the name of a class that can build an editing form for this link.
To instantiate the form class, use an instance of the \Drupal\Core\DependencyInjection\ClassResolverInterface, such as from the class_resolver service. Then call the setMenuLinkInstance() method on the form instance with the menu link plugin instance.
Url|null
getDeleteRoute()
Returns route information for a route to delete the menu link.
Url|null
getEditRoute()
Returns route information for a custom edit form for the menu link.
Plugins should return a value here if they have a special edit form, or if they need to define additional local tasks, local actions, etc. that are visible from the edit form.
Url|null
getTranslateRoute()
Returns route information for a route to translate the menu link.
deleteLink()
Deletes a menu link.
In general, this method should not be called directly, but will be called automatically from MenuLinkManagerInterface::removeDefinition().
This method will only delete the link from any additional storage, but not from the plugin.manager.menu.link service.
int
getCacheMaxAge()
The maximum age for which this object may be cached.
string[]
getCacheContexts()
The cache contexts associated with this object.
These identify a specific variation/representation of the object.
Cache contexts are tokens: placeholders that are converted to cache keys by the @cache_contexts_manager service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.
string[]
getCacheTags()
The cache tags associated with this object.
When this object is modified, these cache tags will be invalidated.
string
getTitle()
Returns the localized title to be shown for this link.
string
getDescription()
Returns the description of the menu link.
array
updateLink(array $new_definition_values, bool $persist)
Updates the definition values for a menu link.
Depending on the implementation details of the class, not all definition values may be changed. For example, changes to the title of a static link will be discarded.
In general, this method should not be called directly, but will be called automatically from MenuLinkManagerInterface::updateDefinition().