function Context::getConstraints

Same name in this branch
  1. 9 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::getConstraints()
Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::getConstraints()
  2. 11.x core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::getConstraints()

File

core/lib/Drupal/Component/Plugin/Context/Context.php, line 78

Class

Context
A generic context class for wrapping data a plugin needs to operate.

Namespace

Drupal\Component\Plugin\Context

Code

public function getConstraints() {
  if (empty($this->contextDefinition['class'])) {
    throw new ContextException("An error was encountered while trying to validate the context.");
  }
  return [
    new Type($this->contextDefinition['class']),
  ];
}

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