ConfigNamesMapper
class ConfigNamesMapper extends PluginBase implements ConfigMapperInterface, ContainerFactoryPluginInterface (View source)
Configuration mapper base implementation.
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 ConfigFactoryInterface | $configFactory | The configuration factory. |
|
| protected TypedConfigManagerInterface | $typedConfigManager | The typed config manager. |
|
| protected LocaleConfigManager | $localeConfigManager | The typed configuration manager. |
|
| protected ConfigMapperManagerInterface | $configMapperManager | The mapper plugin discovery service. |
|
| protected RouteProviderInterface | $routeProvider | The route provider. |
|
| protected Route | $baseRoute | The base route object that the mapper is attached to. |
|
| protected RouteCollection | $routeCollection | The available routes. |
|
| protected string|null | $langcode | The language code of the language this mapper, if any. |
|
| protected LanguageManagerInterface | $languageManager | The language manager. |
|
| protected EventDispatcherInterface | $eventDispatcher | The event dispatcher. |
Methods
Constructs a ConfigNamesMapper.
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.
Creates an instance of the plugin.
Sets the route collection.
Returns title of this translation page.
Returns the name of the base route the mapper is attached to.
Returns the route parameters for the base route the mapper is attached to.
Returns the base route object the mapper is attached to.
Allows to process all config translation routes.
Returns a processed path for the base route the mapper is attached to.
Returns route name for the translation overview route.
Returns the route parameters for the translation overview route.
Returns the route object for a translation overview route.
Returns a processed path for the translation overview route.
Returns route name for the translation add form route.
Returns the route parameters for the translation add form route.
Returns the route object for a translation add form route.
Returns route name for the translation edit form route.
Returns the route parameters for the translation edit form route.
Returns the route object for a translation edit form route.
Returns route name for the translation deletion route.
Returns the route parameters for the translation deletion route.
Returns the route object for the translation deletion route.
Returns an array of configuration names for the mapper.
Adds the given configuration name to the list of names.
Returns the weight of the mapper.
Populate the config mapper with route match data.
Returns the label of the type of data the mapper encapsulates.
Returns the original language code of the configuration.
Returns the language code of a configuration object given its name.
Sets the original language code.
Returns an array with all configuration data.
Checks that all pieces of this configuration mapper have a schema.
Checks if pieces of this configuration mapper have translatables.
Checks whether there is already a translation for this mapper.
Returns the name of the type of data the mapper encapsulates.
Provides an array of information to build a list of operation links.
Returns the name of the contextual link group to add contextual links to.
Details
__construct(string $plugin_id, mixed $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $string_translation, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL)
Constructs a ConfigNamesMapper.
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.
static ContainerFactoryPluginInterface
create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)
Creates an instance of the plugin.
setRouteCollection(RouteCollection $collection)
Sets the route collection.
string
getTitle()
Returns title of this translation page.
string
getBaseRouteName()
Returns the name of the base route the mapper is attached to.
array
getBaseRouteParameters()
Returns the route parameters for the base route the mapper is attached to.
Route
getBaseRoute()
Returns the base route object the mapper is attached to.
protected
processRoute(Route $route)
Allows to process all config translation routes.
string
getBasePath()
Returns a processed path for the base route the mapper is attached to.
string
getOverviewRouteName()
Returns route name for the translation overview route.
array
getOverviewRouteParameters()
Returns the route parameters for the translation overview route.
Route
getOverviewRoute()
Returns the route object for a translation overview route.
string
getOverviewPath()
Returns a processed path for the translation overview route.
string
getAddRouteName()
Returns route name for the translation add form route.
array
getAddRouteParameters()
Returns the route parameters for the translation add form route.
Route
getAddRoute()
Returns the route object for a translation add form route.
string
getEditRouteName()
Returns route name for the translation edit form route.
array
getEditRouteParameters()
Returns the route parameters for the translation edit form route.
Route
getEditRoute()
Returns the route object for a translation edit form route.
string
getDeleteRouteName()
Returns route name for the translation deletion route.
array
getDeleteRouteParameters()
Returns the route parameters for the translation deletion route.
Route
getDeleteRoute()
Returns the route object for the translation deletion route.
array
getConfigNames()
Returns an array of configuration names for the mapper.
addConfigName(string $name)
Adds the given configuration name to the list of names.
Note that it is the responsibility of the calling code to ensure that the configuration exists.
int
getWeight()
Returns the weight of the mapper.
populateFromRouteMatch(RouteMatchInterface $route_match)
Populate the config mapper with route match data.
string
getTypeLabel()
Returns the label of the type of data the mapper encapsulates.
getLangcode()
Returns the original language code of the configuration.
string
getLangcodeFromConfig(string $config_name)
Returns the language code of a configuration object given its name.
$this
setLangcode(string $langcode)
Sets the original language code.
array
getConfigData()
Returns an array with all configuration data.
bool
hasSchema()
Checks that all pieces of this configuration mapper have a schema.
bool
hasTranslatable()
Checks if pieces of this configuration mapper have translatables.
bool
hasTranslation(LanguageInterface $language)
Checks whether there is already a translation for this mapper.
string
getTypeName()
Returns the name of the type of data the mapper encapsulates.
array
getOperations()
Provides an array of information to build a list of operation links.
string|null
getContextualLinkGroup()
Returns the name of the contextual link group to add contextual links to.