You are here

function bat_unit_get_bundles in Booking and Availability Management Tools for Drupal 7

Same name and namespace in other branches
  1. 8 modules/bat_unit/bat_unit.module \bat_unit_get_bundles()

Gets an array of all unit 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

BatUnitBundle[] Depending whether $bundle isset, an array of unit bundles or a single one.

8 calls to bat_unit_get_bundles()
BatTypeUIController::addUnitsPage in modules/bat_unit/bat_type.admin.inc
Creates the markup for the add Bat Units pages when units are added through the Type configuration page.
BatTypeUIController::hook_menu in modules/bat_unit/bat_type.admin.inc
Overrides hook_menu() defaults.
BatUnitUIController::addPage in modules/bat_unit/bat_unit.admin.inc
Creates the markup for the add Unit Entities page within the class so it can easily be extended/overridden.
BatUnitUIController::hook_menu in modules/bat_unit/bat_unit.admin.inc
Overrides hook_menu() defaults.
bat_unit_add_access in modules/bat_unit/bat_unit.module
Access callback: Checks whether the user has permission to add a unit.

... See full list

1 string reference to 'bat_unit_get_bundles'
bat_unit_bundle_form in modules/bat_unit/bat_unit_bundle.admin.inc
Generates the unit bundle editing form.

File

modules/bat_unit/bat_unit.module, line 737

Code

function bat_unit_get_bundles($bundle_name = NULL, $reset = FALSE) {

  // entity_load() will get the Entity controller for our unit entity and call
  // the load function of that object.
  $bundles = entity_load_multiple_by_name('bat_unit_bundle', isset($bundle_name) ? array(
    $bundle_name,
  ) : FALSE);
  return isset($bundle_name) ? reset($bundles) : $bundles;
}