You are here

public function ContextDefinition::setConstraints in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::setConstraints()

Sets the array of validation constraints.

NOTE: This will override any previously set constraints. In most cases ContextDefinitionInterface::addConstraint() should be used instead.

Parameters

array $constraints: The array of constraints.

Return value

$this

Overrides ContextDefinitionInterface::setConstraints

See also

self::addConstraint()

File

core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php, line 222
Contains \Drupal\Core\Plugin\Context\ContextDefinition.

Class

ContextDefinition
Defines a class for context definitions.

Namespace

Drupal\Core\Plugin\Context

Code

public function setConstraints(array $constraints) {
  $this->constraints = $constraints;
  return $this;
}