function bat_unit_state_options 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_state_options()
Helper function to generate a list of available unit states for select lists.
Parameters
string|null $event_type:
array $conditions:
Return value
array Array of available unit states keyed by id.
4 calls to bat_unit_state_options()
- BatEventUiBulkUpdateForm::buildForm in modules/
bat_event_ui/ src/ Form/ BatEventUiBulkUpdateForm.php - Form constructor.
- BatStateWidget::buildConfigurationForm in modules/
bat_facets/ src/ Plugin/ facets/ widget/ BatStateWidget.php - Provides a configuration form for this widget.
- FullcalendarEventManagerForm::ajaxEventStatusChange in modules/
bat_fullcalendar/ src/ Form/ FullcalendarEventManagerForm.php - The callback for the change_event_status widget of the event manager form.
- FullcalendarEventManagerForm::buildForm in modules/
bat_fullcalendar/ src/ Form/ FullcalendarEventManagerForm.php - Form constructor.
File
- modules/
bat_unit/ bat_unit.module, line 460 - 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_state_options($event_type = NULL, $conditions = []) {
$event_states = [];
$states = bat_event_get_states($event_type);
foreach ($states as $event_state) {
$event_states[$event_state
->id()] = $event_state
->label();
}
return $event_states;
}