function FieldDefinitionInterface::isRequired
Same name in other branches
- 9 core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::isRequired()
- 8.9.x core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::isRequired()
- 10 core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::isRequired()
Returns whether the field can be empty.
If a field is required, an entity needs to have at least a valid, non-empty item in that field's FieldItemList in order to pass validation.
An item is considered empty if its isEmpty() method returns TRUE. Typically, that is if at least one of its required properties is empty.
Return value
bool TRUE if the field is required.
Overrides DataDefinitionInterface::isRequired
See also
\Drupal\Core\TypedData\Plugin\DataType\ItemList::isEmpty()
\Drupal\Core\Field\FieldItemInterface::isEmpty()
\Drupal\Core\TypedData\DataDefinitionInterface:isRequired()
\Drupal\Core\TypedData\TypedDataManager::getDefaultConstraints()
1 method overrides FieldDefinitionInterface::isRequired()
- FieldConfigBase::isRequired in core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php
File
-
core/
lib/ Drupal/ Core/ Field/ FieldDefinitionInterface.php, line 177
Class
- FieldDefinitionInterface
- Defines an interface for entity field definitions.
Namespace
Drupal\Core\FieldCode
public function isRequired();
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.