You are here

public function WidgetValidationBase::validate in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/WidgetValidationBase.php \Drupal\entity_browser\WidgetValidationBase::validate()

Validates the widget.

Parameters

array $entities: Array of selected entities.

array $options: (Optional) Array of options needed by the constraint validator.

Return value

\Symfony\Component\Validator\ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.

Overrides WidgetValidationInterface::validate

2 methods override WidgetValidationBase::validate()
Cardinality::validate in src/Plugin/EntityBrowser/WidgetValidation/Cardinality.php
Validates the widget.
File::validate in src/Plugin/EntityBrowser/WidgetValidation/File.php
Validates the widget.

File

src/WidgetValidationBase.php, line 71

Class

WidgetValidationBase
Base implementation for widget validation plugins.

Namespace

Drupal\entity_browser

Code

public function validate(array $entities, array $options = []) {
  $plugin_definition = $this
    ->getPluginDefinition();
  $data_definition = $this
    ->getDataDefinition($plugin_definition['data_type'], $plugin_definition['constraint'], $options);
  return $this
    ->validateDataDefinition($data_definition, $entities);
}