You are here

function rules_execute_action in Rules 6

Execution handler for actions

Parameters

$element The action's configuration element:

$state The current evaluation state:

Return value

TRUE to let rules proceed wit executing actions, only FALSE if $result['#halt'] is set.

1 string reference to 'rules_execute_action'
rules_elements in rules/rules.module
Implementation of hook_elements() Defines default values for all available properties of rules's element types

File

rules/rules.module, line 459
Rules engine module

Code

function rules_execute_action($element, &$state) {
  $exec_args = rules_get_execution_arguments($element, $state);
  if ($exec_args !== FALSE) {
    rules_log(t('Action execution: "@name"', array(
      '@name' => rules_get_element_label($element),
    )));
    $result = rules_element_invoke($element, '', $exec_args);

    //An action may return altered variables, which are saved automatically
    if (isset($result) && is_array($result)) {
      rules_save_variables($element, $result, $state);
    }
  }
  return TRUE;
}