function FieldConfigBase::setRequired

Attributes

#[ActionMethod(adminLabel: new TranslatableMarkup('Set whether field is required'), pluralize: FALSE)]

Parameters

bool $required: TRUE if the field is required. FALSE otherwise.

Return value

$this The current object, for a fluent interface.

Overrides FieldConfigInterface::setRequired

File

core/lib/Drupal/Core/Field/FieldConfigBase.php, line 416

Class

FieldConfigBase
Base class for configurable field definitions.

Namespace

Drupal\Core\Field

Code

public function setRequired($required) {
  $this->required = $required;
  return $this;
}

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