You are here

public function LoopThroughViewResultController::getMaxItemWeight in Business Rules 8

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

File

src/Controller/LoopThroughViewResultController.php, line 135

Class

LoopThroughViewResultController
Class LoopThroughViewResultController.

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