You are here

function bat_booking_get_types in Booking and Availability Management Tools for Drupal 7

Gets an array of all booking types, keyed by the type name.

Parameters

string $type_name: If set, the type with the given name is returned.

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

Return value

BatBookingType[] Depending whether $type isset, an array of booking types or a single one.

5 calls to bat_booking_get_types()
BatBookingUIController::addPage in modules/bat_booking/bat_booking.admin.inc
Creates the markup for the add Booking Entities page within the class so it can easily be extended/overridden.
BatBookingUIController::hook_menu in modules/bat_booking/bat_booking.admin.inc
Overrides hook_menu() defaults.
bat_booking_add_access in modules/bat_booking/bat_booking.module
Access callback: Checks whether the user has permission to add a booking.
bat_booking_entity_info_alter in modules/bat_booking/bat_booking.module
Implements hook_entity_info_alter().
bat_booking_type_load in modules/bat_booking/bat_booking.module
Menu argument loader; Load a booking type by string.
1 string reference to 'bat_booking_get_types'
bat_booking_type_form in modules/bat_booking/bat_booking_type.admin.inc
Generates the booking type editing form.

File

modules/bat_booking/bat_booking.module, line 432

Code

function bat_booking_get_types($type_name = NULL, $reset = FALSE) {

  // entity_load() will get the Entity controller for our booking type
  // entity and call the load function of that object.
  $types = entity_load_multiple_by_name('bat_booking_type', isset($type_name) ? array(
    $type_name,
  ) : FALSE);
  return isset($type_name) ? reset($types) : $types;
}