You are here

public function RulesContainerPlugin::executeByArgs in Rules 7.2

Executes container with the given arguments.

Condition containers just return a boolean while action containers return the configured provided variables as an array of variables.

Overrides RulesPlugin::executeByArgs

1 method overrides RulesContainerPlugin::executeByArgs()
RulesEventSet::executeByArgs in includes/rules.plugins.inc
Executes container with the given arguments.

File

includes/rules.core.inc, line 2326
Rules base classes and interfaces needed for any rule evaluation.

Class

RulesContainerPlugin
Base class for ContainerPlugins like Rules, Logical Operations or Loops.

Code

public function executeByArgs($args = array()) {
  $replacements = array(
    '%label' => $this
      ->label(),
    '@plugin' => $this->itemName,
  );
  rules_log('Executing @plugin %label.', $replacements, RulesLog::INFO, $this, TRUE);
  $this
    ->processSettings();
  $state = $this
    ->setUpState($args);

  // Handle recursion prevention.
  if ($state
    ->isBlocked($this)) {
    return rules_log('Not evaluating @plugin %label to prevent recursion.', array(
      '%label' => $this
        ->label(),
      '@plugin' => $this
        ->plugin(),
    ), RulesLog::INFO);
  }

  // Block the config to prevent any future recursion.
  $state
    ->block($this);
  module_invoke_all('rules_config_execute', $this);
  $result = $this
    ->evaluate($state);
  $return = $this
    ->returnVariables($state, $result);
  $state
    ->unblock($this);
  $state
    ->cleanUp();
  rules_log('Finished executing of @plugin %label.', $replacements, RulesLog::INFO, $this, FALSE);
  return $return;
}