public function WidgetBase::errorElement in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::errorElement()
Assigns a field-level validation error to the right widget sub-element.
Depending on the widget's internal structure, a field-level validation error needs to be flagged on the right sub-element.
Parameters
array $element: An array containing the form element for the widget, as generated by formElement().
\Symfony\Component\Validator\ConstraintViolationInterface $violation: A constraint violation reported during the validation phase.
array $form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array|bool The element on which the error should be flagged, or FALSE to completely ignore the violation (use with care!).
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.
7 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.
- 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.
- TestFieldWidgetMultiple::errorElement in core/
modules/ field/ tests/ modules/ field_test/ src/ Plugin/ Field/ FieldWidget/ TestFieldWidgetMultiple.php - Assigns a field-level validation error to the right widget sub-element.
File
- core/
lib/ Drupal/ Core/ Field/ WidgetBase.php, line 505 - Contains \Drupal\Core\Field\WidgetBase.
Class
- WidgetBase
- Base class for 'Field widget' plugin implementations.
Namespace
Drupal\Core\FieldCode
public function errorElement(array $element, ConstraintViolationInterface $error, array $form, FormStateInterface $form_state) {
return $element;
}