ConfigEntityMapper
class ConfigEntityMapper extends ConfigNamesMapper (View source)
Configuration mapper for configuration entities.
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. |
from ConfigNamesMapper |
| protected TypedConfigManagerInterface | $typedConfigManager | The typed config manager. |
from ConfigNamesMapper |
| protected LocaleConfigManager | $localeConfigManager | The typed configuration manager. |
from ConfigNamesMapper |
| protected ConfigMapperManagerInterface | $configMapperManager | The mapper plugin discovery service. |
from ConfigNamesMapper |
| protected RouteProviderInterface | $routeProvider | The route provider. |
from ConfigNamesMapper |
| protected Route | $baseRoute | The base route object that the mapper is attached to. |
from ConfigNamesMapper |
| protected RouteCollection | $routeCollection | The available routes. |
from ConfigNamesMapper |
| protected string|null | $langcode | The language code of the language this mapper, if any. |
from ConfigNamesMapper |
| protected LanguageManagerInterface | $languageManager | The language manager. |
from ConfigNamesMapper |
| protected EventDispatcherInterface | $eventDispatcher | The event dispatcher. |
from ConfigNamesMapper |
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected string | $entityType | Configuration entity type name. |
|
| protected ConfigEntityInterface | $entity | Loaded entity instance to help produce the translation interface. |
|
| protected string | $typeLabel | The label for the entity type. |
Methods
Constructs a ConfigEntityMapper.
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.
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.
Populate the config mapper with route match data.
Returns the label of the type of data the mapper encapsulates.
Returns the language code of a configuration object given its name.
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.
Gets the entity instance for this mapper.
Set entity type for this mapper.
Gets the entity type from this mapper.
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 $translation_manager, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL)
Constructs a ConfigEntityMapper.
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.
ConfigEntityInterface
getEntity()
Gets the entity instance for this mapper.
bool
setEntity(ConfigEntityInterface $entity)
Sets the entity instance for this mapper.
This method can only be invoked when the concrete entity is known, that is in a request for an entity translation path. After this method is called, the mapper is fully populated with the proper display title and configuration names to use to check permissions or display a translation screen.
bool
setType(string $entity_type)
Set entity type for this mapper.
This should be set in initialization. A mapper that knows its type but not yet its names is still useful for router item and tab generation. The concrete entity only turns out later with actual controller invocations, when the setEntity() method is invoked before the rest of the methods are used.
string
getType()
Gets the entity type from this mapper.