You are here

function bat_event_ids in Booking and Availability Management Tools for Drupal 7

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

Get a list of Event keyed by id and name in value.

File

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

Code

function bat_event_ids($conditions = array()) {
  $events = array();
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'bat_event')
    ->execute();
  if (count($result) > 0) {
    $entities = bat_event_load_multiple(array_keys($result['bat_event']), $conditions);
    foreach ($entities as $event) {
      $wrapper = entity_metadata_wrapper('bat_event', $event);
      $events[$wrapper->event_id
        ->value()] = $wrapper->name
        ->value();
    }
  }
  return $events;
}