public function Context::getConstraints

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::getConstraints()
  2. 8.x drupal/core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::getConstraints()

Implements \Drupal\Component\Plugin\Context\ContextInterface::getConstraints().

Overrides ContextInterface::getConstraints

2 calls to Context::getConstraints()
Context::getConstraints in drupal/core/lib/Drupal/Core/Plugin/Context/Context.php
Implements \Drupal\Component\Plugin\Context\ContextInterface::getConstraints().
Context::validate in drupal/core/lib/Drupal/Component/Plugin/Context/Context.php
Implements \Drupal\Component\Plugin\Context\ContextInterface::validate().
1 method overrides Context::getConstraints()

File

drupal/core/lib/Drupal/Component/Plugin/Context/Context.php, line 71
Contains \Drupal\Component\Plugin\Context\Context.

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 array(
    new Type($this->contextDefinition['class']),
  );
}