function bat_unit_types_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_types_ids()
Helper function to easily get unit types in an array for use in forms, etc.
Return value
array An array of unit types keyed by type id and labels
1 call to bat_unit_types_ids()
- BatCalendarUnitReference::fieldSettingsForm in modules/
bat_calendar_reference/ src/ Plugin/ Field/ FieldType/ BatCalendarUnitReference.php - Returns a form for the field-level settings.
File
- modules/
bat_unit/ bat_unit.module, line 262 - 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_types_ids() {
$unit_types = [];
$types = bat_unit_get_types();
foreach ($types as $type) {
$unit_types[$type
->id()] = $type
->label();
}
return $unit_types;
}