function ContextDefinitionInterface::setConstraints

Same name in other branches
  1. 9 core/lib/Drupal/Component/Plugin/Context/ContextDefinitionInterface.php \Drupal\Component\Plugin\Context\ContextDefinitionInterface::setConstraints()
  2. 8.9.x core/lib/Drupal/Component/Plugin/Context/ContextDefinitionInterface.php \Drupal\Component\Plugin\Context\ContextDefinitionInterface::setConstraints()
  3. 11.x core/lib/Drupal/Component/Plugin/Context/ContextDefinitionInterface.php \Drupal\Component\Plugin\Context\ContextDefinitionInterface::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

See also

self::addConstraint()

1 method overrides ContextDefinitionInterface::setConstraints()
ContextDefinition::setConstraints in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
Sets the array of validation constraints.

File

core/lib/Drupal/Component/Plugin/Context/ContextDefinitionInterface.php, line 150

Class

ContextDefinitionInterface
Interface used to define definition objects found in ContextInterface.

Namespace

Drupal\Component\Plugin\Context

Code

public function setConstraints(array $constraints);

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