You are here

function bat_event_field_widget_form in Booking and Availability Management Tools for Drupal 7

Implements hook_field_widget_form().

File

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

Code

function bat_event_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  switch ($instance['widget']['type']) {
    case 'bat_event_reference_autocomplete':
      $element += array(
        '#type' => 'textfield',
        '#default_value' => isset($items[$delta]['state_id']) ? $items[$delta]['state_id'] : NULL,
        '#autocomplete_path' => $instance['widget']['settings']['autocomplete_path'] . '/' . $instance['entity_type'] . '/' . $instance['bundle'] . '/' . $field['field_name'],
        '#size' => $instance['widget']['settings']['size'],
        '#maxlength' => 255,
        '#element_validate' => array(
          'bat_event_autocomplete_validate',
        ),
        '#value_callback' => 'bat_event_autocomplete_value',
      );
      break;
  }
  return array(
    'state_id' => $element,
  );
}