You are here

function rules_get_variables in Rules 6

Gets an array of variables specified in $names from the current evalutation state.

Parameters

$names: An array of variable names to get.

$state: The current evalutation state.

$force: Use specified variable handlers to load variables, if necessary.

Return value

The array of requested variables with the keys as given in $names. If it's not possible to get all variables, FALSE will be returned.

2 calls to rules_get_variables()
rules_input_evaluator_php_apply in rules/modules/php.rules.inc
Apply the input evaluator.
rules_variable::get in rules/rules.variables.inc
Gets the actual data. Be sure to keep the reference intact.

File

rules/rules.variables.inc, line 52
Provides functions and classes for handling variables

Code

function rules_get_variables($names, &$state, $force = TRUE) {
  $args = array();
  foreach ($names as $key => $name) {
    if (isset($state['variables'][$name])) {
      $args[$key] =& $state['variables'][$name]
        ->get($force);
    }
    else {
      rules_log(t('Warning: Unable to get variable "@name".', array(
        '@name' => $key,
      )));
      return FALSE;
    }
  }
  return $args;
}