public function Element::setError in Express 8
Flags an element as having an error.
Parameters
string $message: (optional) The error message to present to the user.
Return value
$this
Throws
\BadMethodCallException When the element instance was not constructed with a valid form state object.
File
- themes/
contrib/ bootstrap/ src/ Utility/ Element.php, line 638 - Contains \Drupal\bootstrap\Utility\Element.
Class
- Element
- Provides helper methods for Drupal render elements.
Namespace
Drupal\bootstrap\UtilityCode
public function setError($message = '') {
if (!$this->formState) {
throw new \BadMethodCallException('The element instance must be constructed with a valid form state object to use this method.');
}
$this->formState
->setError($this->array, $message);
return $this;
}