protected function RulesContainerPlugin::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.
2 calls to RulesContainerPlugin::stateVariables()
- Rule::stateVariables in includes/
rules.plugins.inc - Returns available state variables for an element.
- RulesLoop::stateVariables in includes/
rules.plugins.inc - Returns available state variables for an element.
4 methods override RulesContainerPlugin::stateVariables()
- Rule::stateVariables in includes/
rules.plugins.inc - Returns available state variables for an element.
- RulesConditionContainer::stateVariables in includes/
rules.core.inc - Overridden to exclude variable assertions of negated conditions.
- RulesEventSet::stateVariables in includes/
rules.plugins.inc - Returns available state variables for an element.
- RulesLoop::stateVariables in includes/
rules.plugins.inc - Returns available state variables for an element.
File
- includes/
rules.core.inc, line 2288 - Rules base classes and interfaces needed for any rule evaluation.
Class
- RulesContainerPlugin
- Base class for ContainerPlugins like Rules, Logical Operations or Loops.
Code
protected function stateVariables($element = NULL) {
$vars = $this
->availableVariables();
if (isset($element)) {
// Add in variables provided by siblings executed before the element.
foreach ($this->children as $child) {
if ($child === $element) {
break;
}
$vars += $child
->providesVariables();
// Take variable info assertions into account.
if ($assertions = $child
->variableInfoAssertions()) {
$vars = RulesData::addMetadataAssertions($vars, $assertions);
}
}
}
return $vars;
}