function ContextDefinitionInterface::addConstraint

Same name in other branches
  1. 9 core/lib/Drupal/Component/Plugin/Context/ContextDefinitionInterface.php \Drupal\Component\Plugin\Context\ContextDefinitionInterface::addConstraint()
  2. 8.9.x core/lib/Drupal/Component/Plugin/Context/ContextDefinitionInterface.php \Drupal\Component\Plugin\Context\ContextDefinitionInterface::addConstraint()
  3. 10 core/lib/Drupal/Component/Plugin/Context/ContextDefinitionInterface.php \Drupal\Component\Plugin\Context\ContextDefinitionInterface::addConstraint()

Adds a validation constraint.

Parameters

string $constraint_name: The name of the constraint to add, i.e. its plugin id.

array|null $options: The constraint options as required by the constraint plugin, or NULL.

Return value

$this

1 method overrides ContextDefinitionInterface::addConstraint()
ContextDefinition::addConstraint in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
Adds a validation constraint.

File

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

Class

ContextDefinitionInterface
Interface used to define definition objects found in ContextInterface.

Namespace

Drupal\Component\Plugin\Context

Code

public function addConstraint($constraint_name, $options = NULL);

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