You are here

function bat_unit_state_options in Booking and Availability Management Tools for Drupal 7

Same name and namespace in other branches
  1. 8 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 $event_type:

array $conditions:

Return value

array Array of available unit states keyed by id.

4 calls to bat_unit_state_options()
BatStateWidget::settingsForm in modules/bat_facets/src/BatStateWidget.php
Overrides FacetapiWidget::settingsForm().
bat_event_ui_bulk_update_form in modules/bat_event_ui/bat_event_ui.module
Bulk update form.
bat_fullcalendar_ajax_event_status_change in modules/bat_fullcalendar/bat_fullcalendar.module
The callback for the change_event_status widget of the event manager form.
bat_fullcalendar_event_manager_form in modules/bat_fullcalendar/bat_fullcalendar.module
The Event Manager Form.

File

modules/bat_unit/bat_unit.module, line 961

Code

function bat_unit_state_options($event_type = NULL, $conditions = array()) {
  $event_states = array();
  $states = bat_event_get_states($event_type);
  foreach ($states as $event_state) {
    foreach ($conditions as $option => $value) {
      if ($event_state[$option] != $value) {
        continue 2;
      }
    }
    $event_states[$event_state['id']] = t($event_state['label']);
  }
  return $event_states;
}