You are here

function availability_calendar_field_widget_info in Availability Calendars 7.3

Same name and namespace in other branches
  1. 7.5 availability_calendar.field.inc \availability_calendar_field_widget_info()
  2. 7.4 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 vieport. Other widgets may be defined in the future or by other modules.

File

./availability_calendar.field.inc, line 164
Availability Calendar module. Defines an availability calendar field.

Code

function availability_calendar_field_widget_info() {
  $settings = array(
    'allow_disable' => 1,
    'show_number_of_months' => 18,
    'first_day_of_week' => 1,
    // 1 = saturday = default change over day
    'show_week_number' => 0,
    'show_only_first_letter' => 0,
    'show_split_day' => 0,
  );
  $viewport_settings = $settings + array(
    'viewport' => array(
      '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('Shows the calendar as a number of months'),
      'description' => '',
      'field types' => $field_types,
      'settings' => $settings,
      'behaviors' => $behaviors,
    ),
    'availability_calendar_viewport' => array(
      'label' => t('Edits 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,
    ),
  );
}