function RulesConditionContainer::stateVariables

Overridden to exclude variable assertions of negated conditions.

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

1 method overrides RulesConditionContainer::stateVariables()
RulesOr::stateVariables in includes/rules.plugins.inc
Overrides RulesContainerPlugin::stateVariables().

File

includes/rules.core.inc, line 2661

Class

RulesConditionContainer
Base class for all condition containers.

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 (!$this->negate && !$child->isNegated() && ($assertions = $child->variableInfoAssertions())) {
        $vars = RulesData::addMetadataAssertions($vars, $assertions);
      }
    }
  }
  return $vars;
}