You are here

function rules_action_save_variable in Rules 6

Base action implementation for adding a new variable and saving variables.

Related topics

1 string reference to 'rules_action_save_variable'
rules_rules_action_info in rules/modules/rules.rules.inc
Implementation of hook_rules_action_info().

File

rules/modules/rules.rules.inc, line 307
rules integration for the rules module

Code

function rules_action_save_variable($name, $variable, $settings, $element, &$state) {
  if (!empty($settings['immediate'])) {
    $map = rules_get_mapped_argument_names($element);

    // Force imediate saving!
    $state['variables'][$map[$name]]
      ->save();
    $state['variables'][$map[$name]]
      ->save_changes();
  }
  else {
    return array(
      $name => $variable,
    );
  }
}