You are here

function bat_event_get_unit_bundles in Booking and Availability Management Tools for Drupal 7

JSON output for autocomplete bat_event_types.

Parameters

string $bat_event_type_name: The bat_event type seed to look for.

File

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

Code

function bat_event_get_unit_bundles($bat_event_type_name = '') {
  $matches = array();
  if ($bat_event_type_name) {
    $result = db_select('bat_event_type')
      ->fields('bat_event_type', array(
      'type',
    ))
      ->condition('type', db_like($bat_event_type_name) . '%', 'LIKE')
      ->range(0, 10)
      ->execute();
    foreach ($result as $unit_bundle) {
      $matches[$unit_bundle->type] = check_plain($unit_bundle->type);
    }
  }
  drupal_json_output($matches);
}