You are here

function availability_calendar_booking_formlet_field_info_inc in Availability Calendars 7.5

Implements hook_field_info(). @link http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...

Provides the descriptions of the fields offered by this module.

1 call to availability_calendar_booking_formlet_field_info_inc()
availability_calendar_booking_formlet_field_info in booking_formlet/availability_calendar_booking_formlet.module
Implements hook_field_info(). @link http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...

File

booking_formlet/availability_calendar_booking_formlet.inc, line 54
General helper methods for Availability Calendar Booking formlet to make the .module file smaller:

Code

function availability_calendar_booking_formlet_field_info_inc() {
  module_load_include('inc', 'availability_calendar');
  $states = availability_calendar_get_states();
  if (!empty($states[4]) && $states[4]['css_class'] == 'cal-opt') {

    // State "Provisionally booked" exists, make this the default for the
    // "booked_state".
    $booked_state = 4;
  }
  else {
    $booked_state = NULL;
  }

  // Set default for "use get" to true if webform version 4 is used.
  $use_get = FALSE;
  if (module_exists('webform')) {
    $info = system_get_info('module', 'webform');
    $use_get = version_compare($info['version'], '7.x-4', '>=');
  }
  return array(
    'availability_calendar_booking_formlet' => array(
      'label' => t('Availability Calendar Booking formlet'),
      'description' => t('Allows to show a booking formlet for entities with an availability calendar.'),
      'settings' => array(
        'define_per_language' => 0,
        'post_url' => array(
          LANGUAGE_NONE => '',
        ),
        'booked_state' => $booked_state,
        'use_get' => $use_get,
      ),
      'instance_settings' => array(),
      'default_widget' => 'availability_calendar_booking_formlet',
      'default_formatter' => 'availability_calendar_booking_formlet',
    ),
  );
}