FieldConfigInterface::setRequired

public function FieldConfigInterface::setRequired

public FieldConfigInterface::setRequired($required)

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.

File

core/lib/Drupal/Core/Field/FieldConfigInterface.php, line 111

Class

FieldConfigInterface
Defines an interface for configurable field definitions.

Namespace

Drupal\Core\Field

Code

public function setRequired($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!FieldConfigInterface.php/function/FieldConfigInterface::setRequired/8.1.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部