function fancybox_field_formatter_settings_form in fancyBox 7.2
Same name and namespace in other branches
- 7 fancybox.module \fancybox_field_formatter_settings_form()
Implements hook_field_formatter_settings_form().
File
- ./
fancybox.module, line 244 - Provides the fancyBox jQuery plugin, a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages, and an extensive settings page for configuring fancyBox settings and how fancyBox…
Code
function fancybox_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$image_style_options = image_style_options(FALSE);
$element['fancybox_image_style_content'] = array(
'#type' => 'select',
'#title' => t('Content image style'),
'#description' => t('The image in the content will be displayed using this image style.'),
'#options' => $image_style_options,
'#empty_option' => t('None (original image)'),
'#default_value' => $settings['fancybox_image_style_content'],
);
$element['fancybox_image_style_fancybox'] = array(
'#type' => 'select',
'#title' => t('fancyBox image style'),
'#description' => t('The image shown in the fancyBox will be displayed using this image style.'),
'#options' => $image_style_options,
'#empty_option' => t('None (original image)'),
'#default_value' => $settings['fancybox_image_style_fancybox'],
);
$element['fancybox_gallery'] = array(
'#type' => 'select',
'#title' => t('Gallery (image grouping)'),
'#description' => t('Group images using this scheme. The <em>data-fancybox-group</em> HTML attribute will be used.'),
'#options' => fancybox_field_formatter_grouping_options(),
'#default_value' => $settings['fancybox_gallery'],
);
$element['fancybox_gallery_custom'] = array(
'#type' => 'textfield',
'#title' => t('Custom grouping'),
'#description' => t('Every image on the page with this grouping value will be grouped together.<br />The <em>data-fancybox-group</em> HTML attribute will be used.<br /><strong>Note</strong>: Must only contain letters, numbers, hyphens and underscores and it must begin with a letter.'),
'#element_validate' => array(
'fancybox_gallery_custom_validate',
),
'#default_value' => $settings['fancybox_gallery_custom'],
'#states' => array(
'visible' => array(
':input[name$="[settings][fancybox_gallery]"]' => array(
'value' => 'custom',
),
),
),
);
$element['fancybox_caption'] = array(
'#type' => 'select',
'#title' => t('Caption'),
'#options' => fancybox_field_formatter_caption_options(),
'#default_value' => $settings['fancybox_caption'],
);
$element['fancybox_caption_custom'] = array(
'#type' => 'textfield',
'#title' => t('Custom caption'),
'#default_value' => $settings['fancybox_caption_custom'],
'#states' => array(
'visible' => array(
':input[name$="[settings][fancybox_caption]"]' => array(
'value' => 'custom',
),
),
),
);
$element['fancybox_caption_custom_tokens_container'] = array(
'#type' => 'container',
'#states' => array(
'visible' => array(
':input[name$="[settings][fancybox_caption]"]' => array(
'value' => 'custom',
),
),
),
);
$element['fancybox_caption_custom_tokens_container']['fancybox_caption_custom_tokens'] = array(
'#theme' => 'token_tree',
'#token_types' => array(
$instance['entity_type'],
'file',
),
);
return $element;
}