You are here

public static function ActionSet::getAvailableItems in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesAction/ActionSet.php \Drupal\business_rules\Plugin\BusinessRulesAction\ActionSet::getAvailableItems()

Return all others actions with the same target Entity and Bundle.

Parameters

\Drupal\business_rules\Entity\Action $action: The business rules Action.

Return value

array Array of actions matched.

1 call to ActionSet::getAvailableItems()
ActionSetController::init in src/Controller/ActionSetController.php
Init properties.

File

src/Plugin/BusinessRulesAction/ActionSet.php, line 63

Class

ActionSet
Class ActionSet.

Namespace

Drupal\business_rules\Plugin\BusinessRulesAction

Code

public static function getAvailableItems(Action $action) {
  $actions = Action::loadMultiple();
  $current_items = $action
    ->getSettings('items');
  $actions_matched = [];
  if (count($actions)) {
    foreach ($actions as $a) {
      if ($action
        ->id() != $a
        ->id() && self::checkInnerAction($action, $a) && !in_array($a
        ->id(), array_keys($current_items))) {
        $actions_matched[] = $a;
      }
    }
  }
  return $actions_matched;
}