function bat_unit_bundles_ids in Booking and Availability Management Tools for Drupal 8
Same name and namespace in other branches
- 7 modules/bat_unit/bat_unit.module \bat_unit_bundles_ids()
Helper function to easily get unit bundles in an array for use in forms, etc.
Return value
array An array of unit bundles keyed by bundle name and labels
File
- modules/
bat_unit/ bat_unit.module, line 245 - Manage units - Units are things that can be booked for some period of time. (e.g. rooms - but also villas bungalows, cars, drills, you-get-the-idea etc.)
Code
function bat_unit_bundles_ids() {
$unit_bundles = [];
$bundles = bat_unit_get_bundles();
foreach ($bundles as $bundle) {
$unit_bundles[$bundle
->bundle()] = $bundle
->label();
}
return $unit_bundles;
}