function picture_field_formatter_settings_summary in Picture 7
Same name and namespace in other branches
- 7.2 picture.module \picture_field_formatter_settings_summary()
Implements hook_field_formatter_settings_summary().
File
- ./
picture.module, line 577 - Picture formatter.
Code
function picture_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$summary = array();
if (isset($settings['picture_group']) && !empty($settings['picture_group'])) {
$picture_mapping = picture_mapping_load($settings['picture_group']);
$breakpoint_group = breakpoints_breakpoint_group_load($picture_mapping->breakpoint_group);
if ($breakpoint_group) {
$summary[] = t('Picture group: @picture_group', array(
'@picture_group' => $breakpoint_group->name,
));
}
else {
$summary[] = t("Picture group doesn't exists");
}
}
else {
$summary[] = t("You have to select a mapping first.");
}
$image_styles = image_style_options(FALSE);
unset($image_styles['']);
if (isset($image_styles[$settings['fallback_image_style']])) {
$summary[] = t('Fallback Image style: @style', array(
'@style' => $image_styles[$settings['fallback_image_style']],
));
}
else {
$summary[] = t('Automatic fallback');
}
$link_types = picture_link_types($instance);
// Display this setting only if image is linked.
if (isset($link_types[$settings['image_link']])) {
$summary[] = filter_xss_admin($link_types[$settings['image_link']]);
}
// Display the settings for the colorbox if chosen.
if ($settings['image_link'] == 'colorbox') {
$summary[] = t('Colorbox Group: @setting', array(
'@setting' => $settings['colorbox_settings']['colorbox_group'],
));
$gallery = array(
'post' => t('Per post gallery'),
'page' => t('Per page gallery'),
'field_post' => t('Per field in post gallery'),
'field_page' => t('Per field in page gallery'),
'custom' => t('Custom'),
'none' => t('No gallery'),
);
$summary[] = t('Colorbox Gallery: @setting', array(
'@setting' => $gallery[$settings['colorbox_settings']['colorbox_gallery']],
));
if ($settings['colorbox_settings']['colorbox_gallery'] == 'custom') {
$summary[] = '→ ' . t('Colorbox Gallery Custom: @setting', array(
'@setting' => $settings['colorbox_settings']['colorbox_gallery_custom'],
));
}
$caption = array(
'auto' => t('Automatic'),
'title' => t('Title text'),
'alt' => t('Alt text'),
'node_title' => t('Content title'),
'custom' => t('Custom (with tokens)'),
'none' => t('None'),
);
$summary[] = t('Colorbox Caption: @setting', array(
'@setting' => $caption[$settings['colorbox_settings']['colorbox_caption']],
));
if ($settings['colorbox_settings']['colorbox_caption'] == 'custom') {
$summary[] = '→ ' . t('Colorbox Caption Custom: @setting', array(
'@setting' => $settings['colorbox_settings']['colorbox_caption_custom'],
));
}
}
return implode('<br />', $summary);
}