You are here

public function RulesConditionalCase::stateVariables in Conditional Rules 7

Same name and namespace in other branches
  1. 8 includes/rules_conditional.plugin.inc \RulesConditionalCase::stateVariables()

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_conditional.plugin.inc, line 300
Rules plugin implementation.

Class

RulesConditionalCase
Switch case.

Code

public function stateVariables($element = NULL) {
  $this
    ->forceSetUp();
  if (!isset($element) || $element === $this->condition) {
    return parent::stateVariables();
  }
  else {

    // Add assertions from the condition.
    $variables = parent::stateVariables($element);
    if (isset($this->condition) && ($assertions = $this->condition
      ->call('variableInfoAssertions'))) {
      $variables = RulesData::addMetadataAssertions($variables, $assertions);
    }
    return $variables;
  }
}