You are here

public function ScheduleTaskController::getMaxItemWeight in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Controller/ScheduleTaskController.php \Drupal\business_rules\Controller\ScheduleTaskController::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 ScheduleTaskController::getMaxItemWeight()
ScheduleTaskController::addItem in src/Controller/ScheduleTaskController.php
Add item on Action.

File

src/Controller/ScheduleTaskController.php, line 145

Class

ScheduleTaskController
Class ScheduleTaskController.

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;
}