class ConfigFieldMapper in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/config_translation/src/ConfigFieldMapper.php \Drupal\config_translation\ConfigFieldMapper
Configuration mapper for fields.
On top of plugin definition values on ConfigEntityMapper, the plugin definition for field mappers are required to contain the following additional keys:
- base_entity_type: The name of the entity type the fields are attached to.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
- class \Drupal\config_translation\ConfigNamesMapper implements ConfigMapperInterface, ContainerFactoryPluginInterface
- class \Drupal\config_translation\ConfigEntityMapper
- class \Drupal\config_translation\ConfigFieldMapper
- class \Drupal\config_translation\ConfigEntityMapper
- class \Drupal\config_translation\ConfigNamesMapper implements ConfigMapperInterface, ContainerFactoryPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
Expanded class hierarchy of ConfigFieldMapper
1 file declares its use of ConfigFieldMapper
- ConfigFieldMapperTest.php in core/
modules/ config_translation/ tests/ src/ Unit/ ConfigFieldMapperTest.php - Contains \Drupal\Tests\config_translation\Unit\ConfigFieldMapperTest.
File
- core/
modules/ config_translation/ src/ ConfigFieldMapper.php, line 20 - Contains \Drupal\config_translation\ConfigFieldMapper.
Namespace
Drupal\config_translationView source
class ConfigFieldMapper extends ConfigEntityMapper {
/**
* Loaded entity instance to help produce the translation interface.
*
* @var \Drupal\field\FieldConfigInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
public function getBaseRouteParameters() {
$parameters = parent::getBaseRouteParameters();
$base_entity_info = $this->entityManager
->getDefinition($this->pluginDefinition['base_entity_type']);
$bundle_parameter_key = $base_entity_info
->getBundleEntityType() ?: 'bundle';
$parameters[$bundle_parameter_key] = $this->entity
->getTargetBundle();
return $parameters;
}
/**
* {@inheritdoc}
*/
public function getOverviewRouteName() {
return 'entity.field_config.config_translation_overview.' . $this->pluginDefinition['base_entity_type'];
}
/**
* {@inheritdoc}
*/
public function getTypeLabel() {
$base_entity_info = $this->entityManager
->getDefinition($this->pluginDefinition['base_entity_type']);
return $this
->t('@label fields', array(
'@label' => $base_entity_info
->getLabel(),
));
}
/**
* {@inheritdoc}
*/
public function setEntity(ConfigEntityInterface $entity) {
if (parent::setEntity($entity)) {
// Field storage config can also contain translatable values. Add the name
// of the config as well to the list of configs for this entity.
/** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
$field_storage = $this->entity
->getFieldStorageDefinition();
/** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type_info */
$entity_type_info = $this->entityManager
->getDefinition($field_storage
->getEntityTypeId());
$this
->addConfigName($entity_type_info
->getConfigPrefix() . '.' . $field_storage
->id());
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigEntityMapper:: |
protected | property | The entity manager. | |
ConfigEntityMapper:: |
protected | property | Configuration entity type name. | |
ConfigEntityMapper:: |
protected | property | The label for the entity type. | |
ConfigEntityMapper:: |
public static | function |
Creates an instance of the plugin. Overrides ConfigNamesMapper:: |
|
ConfigEntityMapper:: |
public | function |
Returns the name of the contextual link group to add contextual links to. Overrides ConfigNamesMapper:: |
|
ConfigEntityMapper:: |
public | function | Gets the entity instance for this mapper. | |
ConfigEntityMapper:: |
public | function |
Provides an array of information to build a list of operation links. Overrides ConfigNamesMapper:: |
|
ConfigEntityMapper:: |
public | function |
Returns title of this translation page. Overrides ConfigNamesMapper:: |
|
ConfigEntityMapper:: |
public | function | Gets the entity type from this mapper. | |
ConfigEntityMapper:: |
public | function |
Returns the name of the type of data the mapper encapsulates. Overrides ConfigNamesMapper:: |
|
ConfigEntityMapper:: |
public | function |
Populate the config mapper with request data. Overrides ConfigNamesMapper:: |
|
ConfigEntityMapper:: |
protected | function |
Allows to process all config translation routes. Overrides ConfigNamesMapper:: |
|
ConfigEntityMapper:: |
public | function | Set entity type for this mapper. | |
ConfigEntityMapper:: |
public | function |
Constructs a ConfigEntityMapper. Overrides ConfigNamesMapper:: |
|
ConfigFieldMapper:: |
protected | property |
Loaded entity instance to help produce the translation interface. Overrides ConfigEntityMapper:: |
|
ConfigFieldMapper:: |
public | function |
Returns the route parameters for the base route the mapper is attached to. Overrides ConfigEntityMapper:: |
|
ConfigFieldMapper:: |
public | function |
Returns route name for the translation overview route. Overrides ConfigEntityMapper:: |
|
ConfigFieldMapper:: |
public | function |
Returns the label of the type of data the mapper encapsulates. Overrides ConfigEntityMapper:: |
|
ConfigFieldMapper:: |
public | function |
Sets the entity instance for this mapper. Overrides ConfigEntityMapper:: |
|
ConfigNamesMapper:: |
protected | property | The base route object that the mapper is attached to. | |
ConfigNamesMapper:: |
protected | property | The configuration factory. | |
ConfigNamesMapper:: |
protected | property | The mapper plugin discovery service. | |
ConfigNamesMapper:: |
protected | property | The language code of the language this mapper, if any. | |
ConfigNamesMapper:: |
protected | property | The language manager. | |
ConfigNamesMapper:: |
protected | property | The typed configuration manager. | |
ConfigNamesMapper:: |
protected | property | The available routes. | |
ConfigNamesMapper:: |
protected | property | The route provider. | |
ConfigNamesMapper:: |
protected | property | The typed config manager. | |
ConfigNamesMapper:: |
public | function |
Adds the given configuration name to the list of names. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route object for a translation add form route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns route name for the translation add form route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route parameters for the translation add form route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns a processed path for the base route the mapper is attached to. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the base route object the mapper is attached to. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the name of the base route the mapper is attached to. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns an array with all configuration data. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns an array of configuration names for the mapper. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route object for the translation deletion route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns route name for the translation deletion route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route parameters for the translation deletion route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route object for a translation edit form route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns route name for the translation edit form route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route parameters for the translation edit form route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the original language code of the configuration. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns a processed path for the translation overview route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route object for a translation overview route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the route parameters for the translation overview route. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Returns the weight of the mapper. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Checks that all pieces of this configuration mapper have a schema. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Checks if pieces of this configuration mapper have translatables. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Checks whether there is already a translation for this mapper. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Sets the original language code. Overrides ConfigMapperInterface:: |
|
ConfigNamesMapper:: |
public | function |
Sets the route collection. Overrides ConfigMapperInterface:: |
|
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 2 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |