You are here

function jquery_carousel_config_form in jQuery carousel 7

Same name and namespace in other branches
  1. 8 jquery_carousel.module \jquery_carousel_config_form()

Helper function to create config form. Reusable for field formatter & views.

3 calls to jquery_carousel_config_form()
JqueryCarouselPluginStyleCarousel::options_form in views/plugins/JqueryCarouselPluginStyleCarousel.inc
Build the settings form for the view.
jquery_carousel_field_formatter_settings_form in ./jquery_carousel.module
Implements hook_field_formatter_settings_form().
_jquery_carousel_settings_format in ./jquery_carousel.module
Helper function to prepare the settings to be exposed in JS.

File

./jquery_carousel.module, line 220
Provide jquery carousel style plugin for views.

Code

function jquery_carousel_config_form() {
  $form = $themes = array();
  foreach (jquery_carousel_themes() as $key => $theme) {
    $themes[$key] = $theme['title'];
  }
  $themes[''] = t('None');
  $form['theme'] = array(
    '#type' => 'select',
    '#title' => t('jQuery Carousel Theme'),
    '#description' => t('Select the theme to be applied to the carousel'),
    '#options' => $themes,
    '#default_value' => '',
  );
  $form['selector'] = array(
    '#type' => 'textfield',
    '#title' => t('Selector for this carousel configuration'),
    '#description' => t('The carousel will be wrapped in this class & JS with the config below gets applied to this selector. Please make sure the selector contains only alphabets. No special characters or spaces allowed.'),
    '#required' => TRUE,
  );
  $form['itemsPerTransition'] = array(
    '#type' => 'textfield',
    '#title' => t('Items per transition'),
    '#description' => t('number of items moved with each transition, default: auto'),
    '#default_value' => '1',
  );
  $form['orientation'] = array(
    '#type' => 'select',
    '#title' => t('Orientation'),
    '#description' => t('Sets the orientation of the carousel, either horizontal or vertical.'),
    '#options' => array(
      'horizontal' => t('Horizontal'),
      'vertical' => t('Vertical'),
    ),
    '#default_value' => 1,
  );
  $form['loop'] = array(
    '#type' => 'select',
    '#title' => t('Loop'),
    '#description' => t('If set to true carousel will loop back to first or last page accordingly.'),
    '#options' => array(
      0 => t('False'),
      1 => t('True'),
    ),
    '#default_value' => 1,
    '#boolean' => TRUE,
  );
  $form['whitespace'] = array(
    '#type' => 'select',
    '#title' => t('Whitespace'),
    '#description' => t("If set to true the carousel will allow whitespace to be seen when there aren't enough items to fill the last page."),
    '#options' => array(
      0 => t('False'),
      1 => t('True'),
    ),
    '#default_value' => 1,
    '#boolean' => TRUE,
  );
  $form['nextPrevActions'] = array(
    '#type' => 'select',
    '#title' => t('Next & Previous Links'),
    '#description' => t('whether next and prev links will be included'),
    '#options' => array(
      0 => t('False'),
      1 => t('True'),
    ),
    '#default_value' => 1,
    '#boolean' => TRUE,
  );
  $form['pagination'] = array(
    '#type' => 'select',
    '#title' => t('Pagination'),
    '#description' => t('whether pagination links will be included'),
    '#options' => array(
      0 => t('False'),
      1 => t('True'),
    ),
    '#default_value' => 1,
    '#boolean' => TRUE,
  );
  $form['speed'] = array(
    '#type' => 'select',
    '#title' => t('Speed'),
    '#description' => t('Animation speed'),
    '#options' => array(
      'normal' => t('Normal'),
      'fast' => t('Fast'),
      'slow' => t('Slow'),
    ),
    '#default_value' => 'normal',
  );
  $form['easing'] = array(
    '#type' => 'select',
    '#title' => t('Easing'),
    '#description' => t('supports the jQuery easing plugin'),
    '#options' => array(
      'linear' => t('Linear'),
      'swing' => t('Swing'),
    ),
    '#default_value' => 'linear',
  );
  $form['autoScroll'] = array(
    '#type' => 'select',
    '#title' => t('Autoscroll'),
    '#description' => t("Set to true to invoke auto scrolling, note when the mouse enters the carousel the interval will stop, it'll consequently begin when the mouse leaves."),
    '#options' => array(
      0 => t('False'),
      1 => t('True'),
    ),
    '#default_value' => 1,
    '#boolean' => TRUE,
  );
  $form['pause'] = array(
    '#type' => 'textfield',
    '#title' => t('Pause'),
    '#description' => t('Sets the amount of time in miliseconds the carousel waits before it automatically scrolls.'),
    '#default_value' => 8000,
  );
  $form['continuous'] = array(
    '#type' => 'select',
    '#title' => t('Continuous'),
    '#description' => t('If set to true the carousel will continuously loop through its pages rather than scrolling all the way back to the first page.'),
    '#options' => array(
      0 => t('False'),
      1 => t('True'),
    ),
    '#default_value' => 1,
    '#boolean' => TRUE,
  );
  $jquery_update_project_link = l(t('jquery_update'), 'http://drupal.org/project/jquery_update');
  $form['touch'] = array(
    '#type' => 'select',
    '#title' => t('Touch'),
    '#description' => t('If set to true the carousel will become draggable allowing you to flick through pages. This feature requires you to enable !jquery_update_project_link.', array(
      '!jquery_update_project_link' => $jquery_update_project_link,
    )),
    '#options' => array(
      0 => t('False'),
      1 => t('True'),
    ),
    '#default_value' => 1,
    '#boolean' => TRUE,
  );
  return $form;
}