private function ConditionSet::generateItemWeight in Business Rules 8
Same name and namespace in other branches
- 2.x src/Plugin/BusinessRulesCondition/ConditionSet.php \Drupal\business_rules\Plugin\BusinessRulesCondition\ConditionSet::generateItemWeight()
Generate the item weight.
Parameters
string $settings_type: The settings type: success|fail.
int $weight: The weight.
Return value
int The generated weight
1 call to ConditionSet::generateItemWeight()
- ConditionSet::formItems in src/
Plugin/ BusinessRulesCondition/ ConditionSet.php - Provide the form fields for add Business Rule's Items.
File
- src/
Plugin/ BusinessRulesCondition/ ConditionSet.php, line 288
Class
- ConditionSet
- Class ConditionSet.
Namespace
Drupal\business_rules\Plugin\BusinessRulesConditionCode
private function generateItemWeight($settings_type, $weight) {
if (!isset($this->usedWeight[$settings_type])) {
$this->usedWeight[$settings_type][] = $weight;
return $weight;
}
if (!in_array($weight, $this->usedWeight[$settings_type])) {
$this->usedWeight[$settings_type][] = $weight;
return $weight;
}
else {
$weight++;
return $this
->generateItemWeight($settings_type, $weight);
}
}