function TextfieldWidget::errorElement
Overrides WidgetBase::errorElement
File
-
core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextfieldWidget.php, line 44
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;
}