You are here

function availability_calendar_field_widget_info in Availability Calendars 7.4

Same name and namespace in other branches
  1. 7.5 availability_calendar.field.inc \availability_calendar_field_widget_info()
  2. 7.3 availability_calendar.field.inc \availability_calendar_field_widget_info()

Implements hook_field_widget_info. @link http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...

This module defines a widget based on a monthly display, optionally in a viewport. Other widgets may be defined in the future or by other modules.

File

./availability_calendar.field.inc, line 176

Code

function availability_calendar_field_widget_info() {
  $settings = array(
    'show_number_of_months' => 18,
    // 6 = saturday = default change over day.
    'first_day_of_week' => variable_get('date_first_day', 6),
    'show_week_number' => 0,
    'show_only_first_letter' => 0,
    'show_split_day' => 0,
  );
  $viewport_settings = $settings + array(
    'viewport' => array(
      'dimensions_calculation' => 'fixed',
      'cols' => 3,
      'rows' => 2,
      'scroll' => 1,
      'button_placement' => 'before',
    ),
  );
  $field_types = array(
    'availability_calendar',
  );
  $behaviors = array(
    'multiple values' => FIELD_BEHAVIOR_DEFAULT,
    'default value' => FIELD_BEHAVIOR_NONE,
  );
  return array(
    'availability_calendar' => array(
      'label' => t('Show the calendar as a number of months'),
      'description' => '',
      'field types' => $field_types,
      'settings' => $settings,
      'behaviors' => $behaviors,
    ),
    'availability_calendar_viewport' => array(
      'label' => t('Show the calendar in a viewport'),
      'description' => t('Allows to define the number of months to show at once, and provides buttons to scroll through the months. Takes up less space.'),
      'field types' => $field_types,
      'settings' => $viewport_settings,
      'behaviors' => $behaviors,
    ),
  );
}