You are here

protected function Rule::stateVariables in Rules 7.2

Returns available state variables for an element.

Returns info about variables available in the evaluation state for any children elements or if given for a special child element.

Parameters

$element: The element for which the available state variables should be returned. If NULL is given, the variables available before any children are invoked are returned. If set to TRUE, the variables available after evaluating all children will be returned.

Overrides RulesContainerPlugin::stateVariables

File

includes/rules.plugins.inc, line 287
Contains plugin info and implementations not needed for rule evaluation.

Class

Rule
An actual rule.

Code

protected function stateVariables($element = NULL) {

  // Don't add in provided action variables for the conditions.
  if (isset($element) && $element === $this->conditions) {
    return $this
      ->availableVariables();
  }
  $vars = parent::stateVariables($element);

  // Take variable info assertions of conditions into account.
  if ($assertions = $this->conditions
    ->variableInfoAssertions()) {
    $vars = RulesData::addMetadataAssertions($vars, $assertions);
  }
  return $vars;
}