You are here

function rules_admin_rule_proxy::_get_available_variables in Rules 6

Gets new variables defined by actions in rules, which are evaluated until this rule.

Parameters

$all: If set to TRUE all variables defined by any rules in this rule set will returned.

2 calls to rules_admin_rule_proxy::_get_available_variables()
rules_admin_rule_proxy::get_available_variables in rules_admin/rules_admin.rule_proxy.inc
Gets info about all available variables This are the arguments of the rule's set as well as further arguments that might be provided by actions of this or preceding rules. Variables set to be hidden are left out.
rules_admin_rule_proxy::get_defined_variables in rules_admin/rules_admin.rule_proxy.inc
Gets info about all defined variables This are all available variables as well as variables defined in and after this rule.

File

rules_admin/rules_admin.rule_proxy.inc, line 272
Contains the rules proxy class

Class

rules_admin_rule_proxy
This is a smally proxy for the real rule. It provides some useful operations for the admin UI. It builds a small index for the elements of a rule, so that they can be easily identified and modified.

Code

function _get_available_variables($all = FALSE) {
  if (!isset($this->_variables[$all])) {
    $this->_variables[$all] = array();
    $set = $this
      ->get_set();

    //sort the rules
    rules_sort_children($set['rules']);
    foreach (element_children($set['rules']) as $name) {
      if ($name == $this
        ->get_rule_name()) {
        if (!$all) {
          return $this->_variables[$all];
        }
      }
      $set['rules'][$name] += array(
        '#actions' => array(),
      );
      foreach ($set['rules'][$name]['#actions'] as $action) {
        $this->_variables[$all] += $this
          ->element_get_new_variables($action);
      }
    }
  }
  return $this->_variables[$all];
}