function TextfieldWidget::errorElement
Same name in other branches
- 8.9.x core/modules/text/src/Plugin/Field/FieldWidget/TextfieldWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextfieldWidget::errorElement()
- 10 core/modules/text/src/Plugin/Field/FieldWidget/TextfieldWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextfieldWidget::errorElement()
- 11.x core/modules/text/src/Plugin/Field/FieldWidget/TextfieldWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextfieldWidget::errorElement()
Overrides WidgetBase::errorElement
File
-
core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextfieldWidget.php, line 39
Class
- TextfieldWidget
- Plugin implementation of the 'text_textfield' widget.
Namespace
Drupal\text\Plugin\Field\FieldWidgetCode
public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
if (isset($element['format']['#access']) && !$element['format']['#access'] && preg_match('/^[0-9]*\\.format$/', $violation->getPropertyPath())) {
// Ignore validation errors for formats that may not be changed,
// such as when existing formats become invalid.
// See \Drupal\filter\Element\TextFormat::processFormat().
return FALSE;
}
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.