protected function RulesConditional::selectBranches in Conditional Rules 8
Same name and namespace in other branches
- 7 includes/rules_conditional.plugin.inc \RulesConditional::selectBranches()
Selects the branches to evaluate for this conditional.
Parameters
RulesState $state: Rules state to use.
Return value
RulesConditionalElement[] An array of branches to evaluate.
Overrides RulesConditionalContainer::selectBranches
File
- includes/
rules_conditional.plugin.inc, line 67 - Rules plugin implementation.
Class
- RulesConditional
- Default if-else conditional statement.
Code
protected function selectBranches(RulesState $state) {
/** @var $branch RulesConditionalElement */
foreach ($this->children as $branch) {
// Select the first matched branch.
if ($branch
->canEvaluate($state)) {
return array(
$branch,
);
}
}
// Return no branch if none matched.
return array();
}