private function ConditionForm::isPartOfConditionSet in Business Rules 8
Same name and namespace in other branches
- 2.x src/Form/ConditionForm.php \Drupal\business_rules\Form\ConditionForm::isPartOfConditionSet()
Check if one condition is part of a conditions set.
Parameters
\Drupal\business_rules\Entity\Condition $condition: The condition.
Return value
bool TRUE|FALSE.
1 call to ConditionForm::isPartOfConditionSet()
- ConditionForm::form in src/
Form/ ConditionForm.php - Gets the actual form array to be built.
File
- src/
Form/ ConditionForm.php, line 103
Class
- ConditionForm
- Class ConditionForm.
Namespace
Drupal\business_rules\FormCode
private function isPartOfConditionSet(Condition $condition) {
$conditions = Condition::loadMultipleByType('logical_and');
$conditions = array_merge($conditions, Condition::loadMultipleByType('logical_or'));
$items = [];
/** @var \Drupal\business_rules\Entity\Condition $c */
foreach ($conditions as $c) {
if (is_array($c
->getSettings('items'))) {
$items = array_merge($items, $c
->getSettings('items'));
}
}
foreach ($items as $item) {
if ($item['type'] == 'condition') {
if ($this->entity
->id() == $item['id']) {
return TRUE;
}
}
}
return FALSE;
}