You are here

public function ContextAwarePluginTrait::validateContexts in Drupal 10

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::validateContexts()

File

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

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;
}