public function FormStateDecoratorBase::setError in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Form/FormStateDecoratorBase.php \Drupal\Core\Form\FormStateDecoratorBase::setError()
Flags an element as having an error.
Parameters
array $element: The form element.
string $message: (optional) The error message to present to the user.
Return value
$this
Overrides FormStateInterface::setError
File
- core/
lib/ Drupal/ Core/ Form/ FormStateDecoratorBase.php, line 633
Class
- FormStateDecoratorBase
- Decorates another form state.
Namespace
Drupal\Core\FormCode
public function setError(array &$element, $message = '') {
$this->decoratedFormState
->setError($element, $message);
return $this;
}