function WidgetBase::errorElement

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::errorElement()
  2. 10 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::errorElement()
  3. 11.x core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::errorElement()

Overrides WidgetInterface::errorElement

1 call to WidgetBase::errorElement()
WidgetBase::flagErrors in core/lib/Drupal/Core/Field/WidgetBase.php
Reports field-level validation errors against actual form elements.
8 methods override WidgetBase::errorElement()
EntityReferenceAutocompleteWidget::errorElement in core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php
Assigns a field-level validation error to the right widget sub-element.
MediaLibraryWidget::errorElement in core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php
Assigns a field-level validation error to the right widget sub-element.
NumberWidget::errorElement in core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php
Assigns a field-level validation error to the right widget sub-element.
PathWidget::errorElement in core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php
Assigns a field-level validation error to the right widget sub-element.
TestFieldWidget::errorElement in core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php
Assigns a field-level validation error to the right widget sub-element.

... See full list

File

core/lib/Drupal/Core/Field/WidgetBase.php, line 530

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\Core\Field

Code

public function errorElement(array $element, ConstraintViolationInterface $error, array $form, FormStateInterface $form_state) {
    return $element;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.