function RulesReactionRule::availableVariables
1 call to RulesReactionRule::availableVariables()
- RulesReactionRule::parameterInfo in includes/
rules.plugins.inc
File
-
includes/
rules.plugins.inc, line 500
Class
- RulesReactionRule
- Represents rules getting triggered by events.
Code
public function availableVariables() {
if (!isset($this->availableVariables)) {
if (isset($this->parent)) {
// Return the event variables provided by the event set, once cached.
$this->availableVariables = $this->parent
->stateVariables();
}
else {
// The intersection of the variables provided by the events are
// available.
foreach ($this->events as $event_name) {
$handler = rules_get_event_handler($event_name, $this->getEventSettings($event_name));
if (isset($this->availableVariables)) {
$event_vars = $handler->availableVariables();
// Merge variable info by intersecting the variable-info keys also,
// so we have only metadata available that is valid for all of the
// provided variables.
foreach (array_intersect_key($this->availableVariables, $event_vars) as $name => $variable_info) {
$this->availableVariables[$name] = array_intersect_key($variable_info, $event_vars[$name]);
}
}
else {
$this->availableVariables = $handler->availableVariables();
}
}
$this->availableVariables = isset($this->availableVariables) ? RulesState::defaultVariables() + $this->availableVariables : RulesState::defaultVariables();
}
}
return $this->availableVariables;
}