public function VariablesSet::getVariable in Business Rules 8
Same name and namespace in other branches
- 2.x src/VariablesSet.php \Drupal\business_rules\VariablesSet::getVariable()
Return variable by id.
Parameters
string $variable_id: The variable id.
Return value
VariableObject|null The variable object or null if variable id not exists.
File
- src/
VariablesSet.php, line 96
Class
- VariablesSet
- Class VariablesSet to be returned on each BusinessRulesVariable plugin.
Namespace
Drupal\business_rulesCode
public function getVariable($variable_id) {
if ($this
->count()) {
foreach ($this->variables as $variable) {
if ($variable
->getId() == $variable_id) {
return $variable;
}
}
}
return NULL;
}