public function FieldConfigInterface::setRequired in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Field/FieldConfigInterface.php \Drupal\Core\Field\FieldConfigInterface::setRequired()
Sets 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.
Parameters
bool $required: TRUE if the field is required. FALSE otherwise.
Return value
$this The current object, for a fluent interface.
1 method overrides FieldConfigInterface::setRequired()
- FieldConfigBase::setRequired in core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php - [@inheritdoc}
File
- core/
lib/ Drupal/ Core/ Field/ FieldConfigInterface.php, line 116 - Contains \Drupal\Core\Field\FieldConfigInterface.
Class
- FieldConfigInterface
- Defines an interface for configurable field definitions.
Namespace
Drupal\Core\FieldCode
public function setRequired($required);