You are here

function bat_unit_get_types 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_types()

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

Parameters

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

Return value

BatType[] Depending whether $bundle isset, an array of types or a single one.

4 calls to bat_unit_get_types()
bat_event_ui_bulk_update_form in modules/bat_event_ui/bat_event_ui.module
Bulk update form.
bat_event_ui_event_type_form in modules/bat_event_ui/bat_event_ui.module
Form - "Event type" and "Unit type" to shows in the calendar view.
bat_unit_handler_type_id_filter::get_value_options in modules/bat_unit/views/bat_unit_handler_type_id_filter.inc
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
bat_unit_types_ids in modules/bat_unit/bat_unit.module
Helper function to easily get unit types in an array for use in forms, etc.

File

modules/bat_unit/bat_unit.module, line 1416

Code

function bat_unit_get_types($bundle_name = NULL) {

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