function viewscarousel_setup_form in Views carousel 5
Generate carousel configuration form.
1 call to viewscarousel_setup_form()
- viewscarousel_form_alter in ./
viewscarousel.module - Implementation of hook_form_alter(). Add carousel settings to block views, on Drupal's block configuration form.
1 string reference to 'viewscarousel_setup_form'
- viewscarousel_menu in ./
viewscarousel.module - Implementation of hook_menu().
File
- ./
viewscarousel.module, line 64 - Enable the creation of dynamic loading carousel widgets with views.
Code
function viewscarousel_setup_form($view_name, $is_block = FALSE) {
$settings = viewscarousel_get_settings($view_name);
$form['carousel_settings'] = array(
'#tree' => TRUE,
);
$form['carousel_settings']['orientation'] = array(
'#title' => t('Orientation'),
'#default_value' => $settings['orientation'],
'#type' => 'select',
'#options' => array(
'vertical' => t('Vertical'),
'horizontal' => t('Horizontal'),
),
);
$form['carousel_settings']['visible_items'] = array(
'#title' => t('Visible items'),
'#type' => 'textfield',
'#default_value' => $settings['visible_items'],
'#description' => t('The number of items that will be visible.'),
);
$form['carousel_settings']['scroll_items'] = array(
'#title' => t('Scroll items'),
'#type' => 'textfield',
'#default_value' => $settings['scroll_items'],
'#description' => t('The number of items to scroll by.'),
);
$form['carousel_settings']['auto_scroll'] = array(
'#title' => t('Auto scroll'),
'#type' => 'textfield',
'#default_value' => $settings['auto_scroll'],
'#description' => t('Specifies how many seconds to periodically auto scroll the content. If set to 0 then auto scroll is turned off.'),
);
$form['carousel_settings']['item_width'] = array(
'#title' => t('Item width'),
'#type' => 'textfield',
'#default_value' => $settings['item_width'],
'#description' => t('Item width in pixels. Pass this, if you want the items set to the specified width. Otherwise, the assigned css value is used.'),
);
$form['carousel_settings']['item_height'] = array(
'#title' => t('Item height'),
'#type' => 'textfield',
'#default_value' => $settings['item_height'],
'#description' => t('Item height in pixels. Pass this, if you want the items set to the specified height. Otherwise, the assigned css value is used.'),
);
$form['carousel_settings']['wrap'] = array(
'#type' => 'checkbox',
'#title' => t('Wrap'),
'#return_value' => TRUE,
'#default_value' => $settings['wrap'],
'#description' => t('Specifies whether to wrap at the last item and jump back to the start.'),
);
$form['view_name'] = array(
'#type' => 'value',
'#value' => $view_name,
);
// If we aren't configuring a block, add a submit button.
if (!$is_block) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
}
return $form;
}