You are here

public static function BusinessRulesItemBase::loadMultipleByType in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Entity/BusinessRulesItemBase.php \Drupal\business_rules\Entity\BusinessRulesItemBase::loadMultipleByType()

Load multiple items by type.

Parameters

string $type: The item type. i.e. The plugin id.

array|null $ids: The items ids.

Return value

array Array with the matched items.

Overrides ItemInterface::loadMultipleByType

File

src/Entity/BusinessRulesItemBase.php, line 270

Class

BusinessRulesItemBase
Class Item.

Namespace

Drupal\business_rules\Entity

Code

public static function loadMultipleByType($type, array $ids = NULL) {
  $items = self::loadMultiple($ids);
  $result = [];

  /** @var \Drupal\business_rules\ItemInterface $item */
  foreach ($items as $item) {
    if ($item
      ->getType() == $type) {
      $result[] = $item;
    }
  }
  return $result;
}