Same name and namespace in other branches
- 8.x-3.x views_slideshow.module \views_slideshow_controls_views_slideshow_widget_form_options()
Implements [widget]_views_slideshow_widget_form_options().
Fichier
-
./
views_slideshow.module, line 413
Code
function views_slideshow_controls_views_slideshow_widget_form_options(&$form, &$form_state, &$view, $defaults, $dependency) {
// Get all the control info from other modules.
$controls = module_invoke_all('views_slideshow_widget_controls_info', $view);
if (!empty($controls)) {
$control_type_options = array();
foreach ($controls as $control_id => $control_info) {
$control_type_options[$control_id] = $control_info['name'];
}
asort($control_type_options);
// Need to wrap this so it indents correctly.
$form['views_slideshow_controls_wrapper'] = array(
'#markup' => '<div class="vs-dependent">',
);
// Add field to see if they would like to hide controls if there is only one
// slide.
$form['hide_on_single_slide'] = array(
'#type' => 'checkbox',
'#title' => t('Hide controls if there is only one slide'),
'#default_value' => $defaults['hide_on_single_slide'],
'#description' => t('Should the controls be hidden if there is only one slide.'),
'#states' => array(
'visible' => array(
':input[name="' . $dependency . '[enable]"]' => array(
'checked' => TRUE,
),
),
),
);
// Create the widget type field.
$form['type'] = array(
'#type' => 'select',
'#title' => t('Controls Type'),
'#description' => t('Style of the controls'),
'#default_value' => $defaults['type'],
'#options' => $control_type_options,
'#states' => array(
'visible' => array(
':input[name="' . $dependency . '[enable]"]' => array(
'checked' => TRUE,
),
),
),
);
// Add any additional form elements
// Build our arguments to pass to
// [pager-type]_views_slideshow_widget_pager_form_options.
$arguments = array(
&$form,
&$form_state,
&$view,
$defaults,
$dependency,
);
foreach ($controls as $control_key => $control_info) {
$function = $control_key . '_views_slideshow_widget_controls_form_options';
if (function_exists($function)) {
call_user_func_array($function, $arguments);
}
}
$form['controls_wrapper_close'] = array(
'#markup' => '</div>',
);
}
else {
$form['enable_controls'] = array(
'#markup' => 'There are no controls available.',
);
}
}