You are here

public function ConditionExpressionContainer::addCondition in Rules 8.3

Creates a condition expression and adds it to the container.

Parameters

string $condition_id: The condition plugin id.

\Drupal\rules\Context\ContextConfig $config: (optional) The configuration for the specified plugin.

Return value

\Drupal\rules\Core\RulesConditionInterface The created condition.

Overrides ConditionExpressionContainerInterface::addCondition

File

src/Engine/ConditionExpressionContainer.php, line 67

Class

ConditionExpressionContainer
Container for conditions.

Namespace

Drupal\rules\Engine

Code

public function addCondition($condition_id, ContextConfig $config = NULL) {
  return $this
    ->addExpressionObject($this->expressionManager
    ->createCondition($condition_id)
    ->setConfiguration($config ? $config
    ->toArray() : []));
}