You are here

function availability_calendar_field_formatter_info in Availability Calendars 7.3

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

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

This module defines a formatter based on a monthly display, optionally in a vieport. Other formatters may be defined in the future or by other modules.

File

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

Code

function availability_calendar_field_formatter_info() {
  $settings = array(
    'show_number_of_months' => 12,
    'first_day_of_week' => variable_get('date_first_day', 1),
    // 1 = saturday = default change over day
    'show_week_number' => 0,
    'show_only_first_letter' => 0,
    'show_split_day' => 0,
    'selectable' => module_exists('availability_calendar_booking_formlet'),
  );
  $viewport_settings = $settings + array(
    'viewport' => array(
      'cols' => 3,
      'rows' => 1,
      'scroll' => 1,
      'button_placement' => 'after',
    ),
  );
  return array(
    'availability_calendar' => array(
      'label' => t('Show the calendar as a set of months'),
      'field types' => array(
        'availability_calendar',
      ),
      'settings' => $settings,
    ),
    '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' => array(
        'availability_calendar',
      ),
      'settings' => $viewport_settings,
    ),
  );
}