public function FieldConfigBase::isRequired
public FieldConfigBase::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 FieldDefinitionInterface::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()
File
- core/lib/Drupal/Core/Field/FieldConfigBase.php, line 370
Class
- FieldConfigBase
- Base class for configurable field definitions.
Namespace
Drupal\Core\FieldCode
public function isRequired() { return $this->required; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!FieldConfigBase.php/function/FieldConfigBase::isRequired/8.1.x