function FormStateInterface::setError
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Form/FormStateInterface.php \Drupal\Core\Form\FormStateInterface::setError()
- 10 core/lib/Drupal/Core/Form/FormStateInterface.php \Drupal\Core\Form\FormStateInterface::setError()
- 11.x core/lib/Drupal/Core/Form/FormStateInterface.php \Drupal\Core\Form\FormStateInterface::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
2 methods override FormStateInterface::setError()
- FormState::setError in core/
lib/ Drupal/ Core/ Form/ FormState.php - Flags an element as having an error.
- FormStateDecoratorBase::setError in core/
lib/ Drupal/ Core/ Form/ FormStateDecoratorBase.php - Flags an element as having an error.
File
-
core/
lib/ Drupal/ Core/ Form/ FormStateInterface.php, line 511
Class
- FormStateInterface
- Provides an interface for an object containing the current state of a form.
Namespace
Drupal\Core\FormCode
public function setError(array &$element, $message = '');
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.