You are here

function bat_event_autocomplete_value in Booking and Availability Management Tools for Drupal 7

Value callback for a bat_event_reference autocomplete element.

1 string reference to 'bat_event_autocomplete_value'
bat_event_field_widget_form in modules/bat_event/bat_event.module
Implements hook_field_widget_form().

File

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

Code

function bat_event_autocomplete_value($element, $input = FALSE, $form_state = array()) {
  if ($input === FALSE) {
    $state_id = $element['#default_value'];
    if (!empty($state_id)) {
      if ($state = bat_event_load_state($state_id)) {
        $value = $state['label'];
        $value .= ' [state_id:' . $state_id . ']';
        return $value;
      }
      else {
        return '';
      }
    }
  }
}