You are here

function jquery_calendar_form_demo in jQuery World Calendars API 7

Form callback for jQuery World Calendars demonstration.

1 string reference to 'jquery_calendar_form_demo'
jquery_calendar_menu in ./jquery_calendar.module
Implements hook_menu().

File

./jquery_calendar.admin.inc, line 53
Contains administration and demonstration form callbacks.

Code

function jquery_calendar_form_demo() {
  $form = array();

  // If the module is not correctly installed, do not show the demo.
  if (!_jquery_calendar_form_requirements($form)) {
    return $form;
  }
  global $base_path;

  // Calendar select widget:
  $form['datepicker_demo_wrapper']['demo'] = array(
    '#type' => 'select',
    '#title' => t('Calendar'),
    '#description' => t('Choose the demonstration calendar system.'),
    '#default_value' => 'gregorian',
    '#attributes' => array(
      'id' => 'datepicker-demo-calendars',
    ),
    '#options' => array(
      'gregorian' => t('Gregorian'),
      'persian' => t('Persian'),
      'thai' => t('Thai'),
      'mayan' => t('Mayan'),
      'hebrew' => t('Hebrew'),
      'coptic' => t('Coptic'),
      'taiwan' => t('Taiwan'),
      'islamic' => t('Islamic'),
      'ethiopian' => t('Ethiopian'),
    ),
    '#suffix' => '<div id="datepicker-demo"></div>',
  );
  $form['datepicker_demo_wrapper']['popup'] = array(
    '#type' => 'textfield',
    '#size' => 40,
    '#default_value' => '',
    '#title' => t('Popup Calendar'),
    '#attributes' => array(
      'class' => array(
        'calendar_systems_js_date_picker_regular',
      ),
    ),
  );

  // API usage example:
  jquery_calendar_add('picker, picker.ext, hebrew, persian, taiwan, thai, islamic, ethiopian, coptic, mayan', array(
    'lang',
    'picker.lang',
  ), variable_get('jquery_calendar_datepicker_theme'), variable_get('jquery_calendar_compression_level'));

  // Add demonstration specific JS and CSS files:
  $path = drupal_get_path('module', 'jquery_calendar');
  drupal_add_js($path . '/jquery_calendar.js');
  drupal_add_css($path . '/jquery_calendar.css');
  return $form;
}