public FieldConfig::getFieldStorageDefinition()
Returns the field storage definition.
Return value
\Drupal\Core\Field\FieldStorageDefinitionInterface The field storage definition.
Overrides FieldDefinitionInterface::getFieldStorageDefinition
File
- core/modules/field/src/Entity/FieldConfig.php, line 282
Class
- FieldConfig
- Defines the Field entity.
Namespace
Drupal\field\Entity
Code
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;
}
Please login to continue.