You are here

function bat_type_group_get_bundles in Booking and Availability Management Tools for Drupal 8

Gets an array of all type group bundles, keyed by the bundle name.

Parameters

string $bundle_name: If set, the bundle with the given name is returned.

bool $reset: A boolean indicating that the internal cache should be reset.

Return value

\Drupal\bat\Entity\TypeGroupBundle[] Depending whether $bundle isset, an array of type group bundles or a single one.

1 call to bat_type_group_get_bundles()
TypeGroupAddAccessCheck::access in src/Access/TypeGroupAddAccessCheck.php
Checks access to the type group add page for the type group bundle.

File

./bat.module, line 583
Contains bat.module..

Code

function bat_type_group_get_bundles($bundle_name = NULL, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityTypeManager()
      ->getStorage('bat_type_group_bundle')
      ->resetCache();
  }
  $types = TypeGroupBundle::loadMultiple();
  return isset($bundle_name) ? $types[$bundle_name] : $types;
}