You are here

public function BusinessRule::getItemMaxWeight in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Entity/BusinessRule.php \Drupal\business_rules\Entity\BusinessRule::getItemMaxWeight()

Get the max weight for the Business Rule's items.

Return value

int The max weight.

Overrides BusinessRuleInterface::getItemMaxWeight

File

src/Entity/BusinessRule.php, line 270

Class

BusinessRule
Defines the Rule entity.

Namespace

Drupal\business_rules\Entity

Code

public function getItemMaxWeight() {
  $items = $this
    ->getItems();
  $max = -10;
  if (is_array($items)) {
    foreach ($items as $item) {
      if ($max < $item
        ->getWeight()) {
        $max = $item
          ->getWeight();
      }
    }
  }
  return $max;
}