You are here

public function BaseFieldDefinition::isStorageRequired in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::isStorageRequired()
  2. 9 core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::isStorageRequired()

Returns whether the field storage is required.

If a field storage is required, NOT NULL constraints will be added automatically for the required properties of a field type.

Return value

bool TRUE if the field storage is required, FALSE otherwise.

Overrides RequiredFieldStorageDefinitionInterface::isStorageRequired

File

core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 790

Class

BaseFieldDefinition
A class for defining entity fields.

Namespace

Drupal\Core\Field

Code

public function isStorageRequired() {
  if (isset($this->definition['storage_required'])) {
    return (bool) $this->definition['storage_required'];
  }

  // Default to the 'required' property of the base field.
  return $this
    ->isRequired();
}