You are here

function bat_event_get_states in Booking and Availability Management Tools for Drupal 8

Same name and namespace in other branches
  1. 7 modules/bat_event/bat_event.module \bat_event_get_states()

Parameters

string|null $event_type:

array $conditions:

Return value

array|false

4 calls to bat_event_get_states()
bat_event_field_widget_form_alter in modules/bat_event/bat_event.module
Implements hook_field_widget_WIDGET_TYPE_form_alter().
bat_unit_state_options in modules/bat_unit/bat_unit.module
Helper function to generate a list of available unit states for select lists.
BookingConfirmationForm::submitForm in modules/bat_booking/bat_booking_example/src/Form/BookingConfirmationForm.php
Form submission handler.
UnitSetStateAction::buildForm in modules/bat_unit/src/Form/UnitSetStateAction.php
Form constructor.

File

modules/bat_event/bat_event.module, line 1070
Manage Events - Events store the EventValue of a Unit over a period of time.

Code

function bat_event_get_states($event_type = NULL, $conditions = []) {
  $query = \Drupal::entityQuery('state');
  if ($event_type !== NULL) {
    $query
      ->condition('event_type', $event_type);
  }
  foreach ($conditions as $key => $value) {
    $query
      ->condition($key, $value);
  }
  $result = $query
    ->execute();
  if (count($result) > 0) {
    return State::loadMultiple($result);
  }
  return FALSE;
}