public function FormWidgetInterface::flagViolations in Typed Data API enhancements 8
Reports validation errors against actual form elements.
Depending on the widget's internal structure, a property-level validation error needs to be flagged on the right sub-element.
Note that validation is run according to the validation constraints of the data definition. In addition to that, widget-level validation may be provided using the regular #element_validate callbacks of the form API.
Parameters
\Drupal\Core\TypedData\TypedDataInterface $data: The data to be edited.
\Symfony\Component\Validator\ConstraintViolationListInterface $violations: A list of constraint violations to flag.
\Drupal\Core\Form\SubformStateInterface $formState: The form state of the widget's form.
6 methods override FormWidgetInterface::flagViolations()
- BrokenWidget::flagViolations in src/
Plugin/ TypedDataFormWidget/ BrokenWidget.php - Reports validation errors against actual form elements.
- DatetimeRangeWidget::flagViolations in src/
Plugin/ TypedDataFormWidget/ DatetimeRangeWidget.php - Reports validation errors against actual form elements.
- DatetimeWidget::flagViolations in src/
Plugin/ TypedDataFormWidget/ DatetimeWidget.php - Reports validation errors against actual form elements.
- SelectWidget::flagViolations in src/
Plugin/ TypedDataFormWidget/ SelectWidget.php - Reports validation errors against actual form elements.
- TextareaWidget::flagViolations in src/
Plugin/ TypedDataFormWidget/ TextareaWidget.php - Reports validation errors against actual form elements.
File
- src/
Widget/ FormWidgetInterface.php, line 77
Class
- FormWidgetInterface
- Interface definition for form widget plugins.
Namespace
Drupal\typed_data\WidgetCode
public function flagViolations(TypedDataInterface $data, ConstraintViolationListInterface $violations, SubformStateInterface $formState);