function DataDefinition::isRequired

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::isRequired()
  2. 8.9.x core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::isRequired()
  3. 10 core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::isRequired()

Overrides DataDefinitionInterface::isRequired

2 calls to DataDefinition::isRequired()
BaseFieldDefinition::isStorageRequired in core/lib/Drupal/Core/Field/BaseFieldDefinition.php
Returns whether the field storage is required.
DataDefinition::getConstraints in core/lib/Drupal/Core/TypedData/DataDefinition.php
Returns an array of validation constraints.

File

core/lib/Drupal/Core/TypedData/DataDefinition.php, line 169

Class

DataDefinition
A typed data definition class for defining data based on defined data types.

Namespace

Drupal\Core\TypedData

Code

public function isRequired() {
    return !empty($this->definition['required']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.