function bat_type_bundle_ids in Booking and Availability Management Tools for Drupal 7
Same name and namespace in other branches
- 8 modules/bat_unit/bat_unit.module \bat_type_bundle_ids()
Gets a list of Bat Type bundles keyed by id and name in value.
File
- modules/
bat_unit/ bat_unit.module, line 1665
Code
function bat_type_bundle_ids() {
$type_bundles = array();
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'bat_type_bundle');
$result = $query
->execute();
if (count($result) > 0) {
$entities = entity_load('bat_type_bundle', array_keys($result['bat_type_bundle']));
foreach ($entities as $type_bundle) {
$wrapper = entity_metadata_wrapper('bat_type_bundle', $type_bundle);
$type_bundles[$wrapper->id
->value()] = $wrapper->label
->value();
}
}
return $type_bundles;
}