function bat_unit_get_type_bundles in Booking and Availability Management Tools for Drupal 7
Same name and namespace in other branches
- 8 modules/bat_unit/bat_unit.module \bat_unit_get_type_bundles()
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
BatTypeBundle[] Depending whether $bundle isset, an array of type bundles or a single one.
6 calls to bat_unit_get_type_bundles()
- BatTypeUIController::addPage in modules/
bat_unit/ bat_type.admin.inc - Creates the markup for the add Bat Type Entities page within the class so it can easily be extended/overridden.
- BatTypeUIController::hook_menu in modules/
bat_unit/ bat_type.admin.inc - Overrides hook_menu() defaults.
- bat_type_add_access in modules/
bat_unit/ bat_unit.module - Access callback: Checks whether the user has permission to add a type.
- bat_type_bundles_ids in modules/
bat_unit/ bat_unit.module - Helper function to easily get Bat Type bundles in an array for use in forms, etc.
- bat_type_bundle_load in modules/
bat_unit/ bat_unit.module - Menu argument loader; Load a Bat Type bundle by string.
1 string reference to 'bat_unit_get_type_bundles'
- bat_type_bundle_form in modules/
bat_unit/ bat_type_bundle.admin.inc - Generates the unit bundle editing form.
File
- modules/
bat_unit/ bat_unit.module, line 1400
Code
function bat_unit_get_type_bundles($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_bundle', isset($bundle_name) ? array(
$bundle_name,
) : FALSE);
return isset($bundle_name) ? reset($bundles) : $bundles;
}