Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConfigFieldMapper.php

function ConfigFieldMapper::setEntity

Overrides ConfigEntityMapper::setEntity

File

core/modules/config_translation/src/ConfigFieldMapper.php, line 53

Class

ConfigFieldMapper
Configuration mapper for fields.

Namespace

Drupal\config_translation

Code

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->entityTypeManager
            ->getDefinition($field_storage->getEntityTypeId());
        $this->addConfigName($entity_type_info->getConfigPrefix() . '.' . $field_storage->id());
        return TRUE;
    }
    return FALSE;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal