function galleryformatter_field_formatter_settings_form in Gallery formatter 7
Implements hook_field_formatter_settings_form().
File
- ./
galleryformatter.module, line 30
Code
function galleryformatter_field_formatter_settings_form($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$form = array();
$options = array(
t('None'),
);
// get a list of all style names for our form options
foreach (image_styles() as $id => $style) {
$options[$id] = $id;
}
$form['slide_style'] = array(
'#type' => 'select',
'#title' => t('Select the slide style'),
'#options' => $options,
'#default_value' => $settings['slide_style'],
'#description' => t('Select the imagecache style you would like to show when clicked on the thumbnail.'),
);
$form['thumb_style'] = array(
'#type' => 'select',
'#title' => t('Select the thumbnail style'),
'#options' => $options,
'#default_value' => $settings['thumb_style'],
'#description' => t('Select the imagecache style you would like to show for the thumbnails list.'),
);
$style_options = array();
$styles = module_invoke_all('galleryformatter_styles');
// The keys used for options must be valid html id-s.
foreach ($styles as $style) {
$style_options[$style] = $style;
}
ksort($style_options);
$form['style'] = array(
'#type' => 'select',
'#title' => t('Style'),
'#options' => array(
'nostyle' => t('No style'),
) + $style_options,
'#default_value' => $settings['style'],
'#description' => t('Choose the gallery style.'),
);
$form['link_to_full'] = array(
'#type' => 'checkbox',
'#title' => t('Link slides to the full image'),
'#default_value' => $settings['link_to_full'],
'#description' => t('If you check this on, the slides will be linked to the style you choose in <em>Select the full image style</em> below.'),
);
$options[0] = t('None (original image)');
$form['link_to_full_style'] = array(
'#type' => 'select',
'#title' => t('Select the full image style'),
'#options' => $options,
'#default_value' => $settings['link_to_full_style'],
'#description' => t('Select the imagecache style you would like to show when clicked on the thumbnail.<br />If you select none, the the link will point to the original image.'),
'#states' => array(
'visible' => array(
':input[name="fields[' . $field['field_name'] . '][settings_edit_form][settings][link_to_full]"]' => array(
'checked' => TRUE,
),
),
),
);
$modal_options = array();
// integration with other modules for jQuery modal windows
if (module_exists('colorbox')) {
$modal_options['colorbox'] = 'colorbox';
}
if (module_exists('shadowbox')) {
$modal_options['shadowbox'] = 'shadowbox';
}
if (module_exists('lightbox2')) {
$modal_options['lightbox2'] = 'lightbox2';
}
if (module_exists('fancybox')) {
$modal_options['fancybox'] = 'fancybox';
}
$modal_options['none'] = t('Do not use modal');
$form['modal'] = array(
'#type' => 'select',
'#title' => t('Use jQuery modal for full image link'),
'#options' => $modal_options,
'#default_value' => $settings['modal'],
'#description' => t("Select which jQuery modal module you'd like to display the full link image in, if any."),
'#states' => array(
'visible' => array(
':input[name="fields[' . $field['field_name'] . '][settings_edit_form][settings][link_to_full]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['linking_method'] = array(
'#type' => 'select',
'#title' => t('How to link to the full image'),
'#options' => array(
'show_full_link' => t('Using a link'),
'onclick_full' => t('On slide click'),
),
'#default_value' => $settings['linking_method'],
'#description' => t('On slide click means that when you click on the slide it will open the full image.<br /> Using a link means a magnify glass in default style.'),
'#states' => array(
'visible' => array(
':input[name="fields[' . $field['field_name'] . '][settings_edit_form][settings][link_to_full]"]' => array(
'checked' => TRUE,
),
),
),
);
return $form;
}