public function FieldConfig::getFieldStorageDefinition in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field/src/Entity/FieldConfig.php \Drupal\field\Entity\FieldConfig::getFieldStorageDefinition()
Returns the field storage definition.
Return value
\Drupal\Core\Field\FieldStorageDefinitionInterface The field storage definition.
Overrides FieldDefinitionInterface::getFieldStorageDefinition
2 calls to FieldConfig::getFieldStorageDefinition()
- FieldConfig::postCreate in core/
modules/ field/ src/ Entity/ FieldConfig.php - Acts on a created entity before hooks are invoked.
- FieldConfig::preSave in core/
modules/ field/ src/ Entity/ FieldConfig.php - Overrides \Drupal\Core\Entity\Entity::preSave().
File
- core/
modules/ field/ src/ Entity/ FieldConfig.php, line 287 - Contains \Drupal\field\Entity\FieldConfig.
Class
- FieldConfig
- Defines the Field entity.
Namespace
Drupal\field\EntityCode
public function getFieldStorageDefinition() {
if (!$this->fieldStorage) {
$fields = $this
->entityManager()
->getFieldStorageDefinitions($this->entity_type);
if (!isset($fields[$this->field_name])) {
throw new FieldException("Attempt to create a field {$this->field_name} that does not exist on entity type {$this->entity_type}.");
}
if (!$fields[$this->field_name] instanceof FieldStorageConfigInterface) {
throw new FieldException("Attempt to create a configurable field of non-configurable field storage {$this->field_name}.");
}
$this->fieldStorage = $fields[$this->field_name];
}
return $this->fieldStorage;
}