function jquery_carousel_config_form in jQuery carousel 8
Same name and namespace in other branches
- 7 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()
- jCarouselFieldFormatter::settingsForm in src/
Plugin/ Field/ FieldFormatter/ jCarouselFieldFormatter.php - Returns a form to configure settings for the formatter.
- JqueryCarousel::buildOptionsForm in src/
Plugin/ views/ style/ JqueryCarousel.php - Provide a form to edit options for this plugin.
- _jquery_carousel_settings_format in ./
jquery_carousel.module - Helper function to prepare the settings to be exposed in JS.
File
- ./
jquery_carousel.module, line 141 - Provide jquery carousel style plugin for views.
Code
function jquery_carousel_config_form() {
$form = $themes = [];
foreach (jquery_carousel_themes() as $key => $theme) {
$themes[$key] = $theme['title'];
}
$themes[''] = t('None');
$form['theme'] = [
'#type' => 'select',
'#title' => t('jQuery Carousel Theme'),
'#description' => t('Select the theme to be applied to the carousel'),
'#options' => $themes,
'#default_value' => '',
];
$form['selector'] = [
'#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,
'#default_value' => 'rs-carousel',
];
$form['itemsPerTransition'] = [
'#type' => 'textfield',
'#title' => t('Items per transition'),
'#description' => t('number of items moved with each transition, default: auto'),
'#default_value' => 'auto',
];
$form['orientation'] = [
'#type' => 'select',
'#title' => t('Orientation'),
'#description' => t('Sets the orientation of the carousel, either horizontal or vertical.'),
'#options' => [
'horizontal' => t('Horizontal'),
'vertical' => t('Vertical'),
],
'#default_value' => 1,
];
$form['loop'] = [
'#type' => 'select',
'#title' => t('Loop'),
'#description' => t('If set to true carousel will loop back to first or last page accordingly.'),
'#options' => [
0 => t('False'),
1 => t('True'),
],
'#default_value' => 1,
'#boolean' => TRUE,
];
$form['whitespace'] = [
'#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' => [
0 => t('False'),
1 => t('True'),
],
'#default_value' => 1,
'#boolean' => TRUE,
];
$form['nextPrevActions'] = [
'#type' => 'select',
'#title' => t('Next & Previous Links'),
'#description' => t('whether next and prev links will be included'),
'#options' => [
0 => t('False'),
1 => t('True'),
],
'#default_value' => 1,
'#boolean' => TRUE,
];
$form['pagination'] = [
'#type' => 'select',
'#title' => t('Pagination'),
'#description' => t('whether pagination links will be included'),
'#options' => [
0 => t('False'),
1 => t('True'),
],
'#default_value' => 1,
'#boolean' => TRUE,
];
$form['speed'] = [
'#type' => 'select',
'#title' => t('Speed'),
'#description' => t('Animation speed'),
'#options' => [
'normal' => t('Normal'),
'fast' => t('Fast'),
'slow' => t('Slow'),
],
'#default_value' => 'normal',
];
$form['easing'] = [
'#type' => 'select',
'#title' => t('Easing'),
'#description' => t('supports the jQuery easing plugin'),
'#options' => [
'linear' => t('Linear'),
'swing' => t('Swing'),
],
'#default_value' => 'linear',
];
$form['autoScroll'] = [
'#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' => [
0 => t('False'),
1 => t('True'),
],
'#default_value' => 1,
'#boolean' => TRUE,
];
$form['interval'] = [
'#type' => 'textfield',
'#title' => t('Interval'),
'#description' => t('Sets the amount of time in milliseconds the carousel waits before it automatically scrolls.'),
'#default_value' => 8000,
];
$form['continuous'] = [
'#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' => [
0 => t('False'),
1 => t('True'),
],
'#default_value' => 1,
'#boolean' => TRUE,
];
$form['touch'] = [
'#type' => 'select',
'#title' => t('Touch'),
'#description' => t('If set to true the carousel will become draggable allowing you to flick through pages.'),
'#options' => [
0 => t('False'),
1 => t('True'),
],
'#default_value' => 1,
'#boolean' => TRUE,
];
return $form;
}