You are here

public function ContextAwarePluginTrait::validateContexts in Drupal 9

File

core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php, line 190

Class

ContextAwarePluginTrait
Provides a trait to add context-aware functionality to plugins.

Namespace

Drupal\Core\Plugin

Code

public function validateContexts() {
  $violations = new ConstraintViolationList();

  // @todo Implement the Symfony Validator component to let the validator
  //   traverse and set property paths accordingly.
  //   See https://www.drupal.org/project/drupal/issues/3153847.
  foreach ($this
    ->getContexts() as $context) {
    $violations
      ->addAll($context
      ->validate());
  }
  return $violations;
}