class FieldConfigStorageBase
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Field/FieldConfigStorageBase.php \Drupal\Core\Field\FieldConfigStorageBase
Base storage class for field config entities.
Hierarchy
- class \Drupal\Core\Entity\EntityHandlerBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Entity\EntityStorageBase extends \Drupal\Core\Entity\EntityStorageInterface, \Drupal\Core\Entity\EntityHandlerInterface implements \Drupal\Core\Entity\EntityHandlerBase
- class \Drupal\Core\Config\Entity\ConfigEntityStorage extends \Drupal\Core\Config\Entity\ConfigEntityStorageInterface, \Drupal\Core\Config\Entity\ImportableEntityStorageInterface implements \Drupal\Core\Entity\EntityStorageBase
- class \Drupal\Core\Field\FieldConfigStorageBase implements \Drupal\Core\Config\Entity\ConfigEntityStorage
- class \Drupal\Core\Config\Entity\ConfigEntityStorage extends \Drupal\Core\Config\Entity\ConfigEntityStorageInterface, \Drupal\Core\Config\Entity\ImportableEntityStorageInterface implements \Drupal\Core\Entity\EntityStorageBase
- class \Drupal\Core\Entity\EntityStorageBase extends \Drupal\Core\Entity\EntityStorageInterface, \Drupal\Core\Entity\EntityHandlerInterface implements \Drupal\Core\Entity\EntityHandlerBase
Expanded class hierarchy of FieldConfigStorageBase
1 file declares its use of FieldConfigStorageBase
- FieldConfigStorage.php in core/
modules/ field/ src/ FieldConfigStorage.php
File
-
core/
lib/ Drupal/ Core/ Field/ FieldConfigStorageBase.php, line 12
Namespace
Drupal\Core\FieldView source
abstract class FieldConfigStorageBase extends ConfigEntityStorage {
/**
* The field type plugin manager.
*
* @var \Drupal\Core\Field\FieldTypePluginManagerInterface
*/
protected $fieldTypeManager;
/**
* {@inheritdoc}
*/
protected function mapFromStorageRecords(array $records) {
foreach ($records as $id => &$record) {
try {
$class = $this->fieldTypeManager
->getPluginClass($record['field_type']);
} catch (PluginNotFoundException $e) {
$config_id = $this->getPrefix() . $id;
throw new PluginNotFoundException($record['field_type'], "Unable to determine class for field type '{$record['field_type']}' found in the '{$config_id}' configuration", $e->getCode(), $e);
}
$record['settings'] = $class::fieldSettingsFromConfigData($record['settings']);
}
return parent::mapFromStorageRecords($records);
}
/**
* {@inheritdoc}
*/
protected function mapToStorageRecord(EntityInterface $entity) {
$record = parent::mapToStorageRecord($entity);
$class = $this->fieldTypeManager
->getPluginClass($record['field_type']);
$record['settings'] = $class::fieldSettingsToConfigData($record['settings']);
return $record;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.