public function ViewsRulesLoop::evaluateRow in Views Rules 7
Evaluates a view row in the loop.
Overrides ViewsRulesIterable::evaluateRow
File
- rules/
views_rules.plugin.inc, line 89 - Views Rules plugin implementations.
Class
- ViewsRulesLoop
- Loop plugin for using results from a view with Rules displays.
Code
public function evaluateRow(array $data) {
// Clone state to evaluate children in a sandbox.
$rowState = clone $this->viewLoopState;
// Fill in state data.
foreach ($this
->rowVariables() as $name => $info) {
$rowState
->addVariable($name, $data[$info['source name']], $info);
}
parent::evaluate($rowState);
// Update variables from parent scope.
foreach ($this->viewLoopState->variables as $key => &$value) {
if (array_key_exists($key, $rowState->variables)) {
$value = $rowState->variables[$key];
}
}
}