You are here

public function ActionSetController::getMaxItemWeight in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Controller/ActionSetController.php \Drupal\business_rules\Controller\ActionSetController::getMaxItemWeight()

Get the bigger weight for the action items.

Parameters

\Drupal\business_rules\ActionInterface $action: The action to get the bigger item weight.

Return value

int The bigger weight for the action items.

1 call to ActionSetController::getMaxItemWeight()
ActionSetController::addItem in src/Controller/ActionSetController.php
Add item on Action.

File

src/Controller/ActionSetController.php, line 143

Class

ActionSetController
Class ActionSetController.

Namespace

Drupal\business_rules\Controller

Code

public function getMaxItemWeight(ActionInterface $action) {
  $items = $action
    ->getSettings('items');
  $max = -100;
  if (is_array($items)) {
    foreach ($items as $item) {
      if ($max < $item['weight']) {
        $max = $item['weight'];
      }
    }
  }
  return $max;
}