You are here

ActionSetExpression.php in Rules 8.3

File

src/Plugin/RulesExpression/ActionSetExpression.php
View source
<?php

namespace Drupal\rules\Plugin\RulesExpression;

use Drupal\rules\Context\ExecutionStateInterface;
use Drupal\rules\Engine\ActionExpressionContainer;

/**
 * Holds a set of actions and executes all of them.
 *
 * @RulesExpression(
 *   id = "rules_action_set",
 *   label = @Translation("Action set"),
 *   form_class = "\Drupal\rules\Form\Expression\ActionContainerForm"
 * )
 */
class ActionSetExpression extends ActionExpressionContainer {

  /**
   * {@inheritdoc}
   */
  protected function allowsMetadataAssertions() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function executeWithState(ExecutionStateInterface $state) {

    // Use the iterator to ensure the actions are sorted.
    foreach ($this as $action) {

      /** @var \Drupal\rules\Engine\ExpressionInterface $action */
      $action
        ->executeWithState($state);
    }
  }

}

Classes

Namesort descending Description
ActionSetExpression Holds a set of actions and executes all of them.