function ContextAwarePluginTrait::validateContexts

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::validateContexts()
  2. 10 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.