protected function WidgetBase::runWidgetValidators in Entity Browser 8
Same name and namespace in other branches
- 8.2 src/WidgetBase.php \Drupal\entity_browser\WidgetBase::runWidgetValidators()
Run widget validators.
Parameters
array $entities: Array of entity ids to validate.
array $validators: Array of widget validator ids.
Return value
\Symfony\Component\Validator\ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.
1 call to WidgetBase::runWidgetValidators()
- WidgetBase::validate in src/
WidgetBase.php - Validates form.
File
- src/
WidgetBase.php, line 314
Class
- WidgetBase
- Base class for widget plugins.
Namespace
Drupal\entity_browserCode
protected function runWidgetValidators(array $entities, $validators = []) {
$violations = new ConstraintViolationList();
foreach ($validators as $validator_id => $options) {
/** @var \Drupal\entity_browser\WidgetValidationInterface $widget_validator */
$widget_validator = $this->validationManager
->createInstance($validator_id, []);
if ($widget_validator) {
$violations
->addAll($widget_validator
->validate($entities, $options));
}
}
return $violations;
}