Commit c6d0fd92 authored by frjo's avatar frjo
Browse files

Issue #1701648 by wildermuthn, frjo: Different size for first image in group.

parent 0e5e2009
......@@ -44,6 +44,7 @@ function colorbox_theme() {
'node' => NULL, // Left for legacy support.
'field' => array(),
'display_settings' => array(),
'delta' => null,
),
'file' => 'colorbox.theme.inc',
),
......@@ -256,6 +257,7 @@ function colorbox_field_formatter_info() {
'field types' => array('image'),
'settings' => array(
'colorbox_node_style' => '',
'colorbox_node_style_first' => '',
'colorbox_image_style' => '',
'colorbox_gallery' => 'post',
'colorbox_gallery_custom' => '',
......@@ -285,6 +287,14 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
'#options' => $image_styles_hide,
'#description' => t('Image style to use in the content.'),
);
$element['colorbox_node_style_first'] = array(
'#title' => t('Content image style for first image'),
'#type' => 'select',
'#default_value' => $settings['colorbox_node_style_first'],
'#empty_option' => t('No special style.'),
'#options' => $image_styles,
'#description' => t('Image style to use in the content for the first image.'),
);
$element['colorbox_image_style'] = array(
'#title' => t('Colorbox image style'),
'#type' => 'select',
......@@ -415,6 +425,10 @@ function colorbox_field_formatter_settings_summary($field, $instance, $view_mode
$summary[] = t('Content image style: Original image');
}
if (isset($image_styles[$settings['colorbox_node_style_first']])) {
$summary[] = t('Content image style of first image: @style', array('@style' => $image_styles[$settings['colorbox_node_style_first']]));
}
if (isset($image_styles[$settings['colorbox_image_style']])) {
$summary[] = t('Colorbox image style: @style', array('@style' => $image_styles[$settings['colorbox_image_style']]));
}
......@@ -466,6 +480,7 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
'#node' => $entity, // Left for legacy support.
'#field' => $field,
'#display_settings' => $display['settings'],
'#delta' => $delta,
);
}
}
......
......@@ -30,6 +30,10 @@ function theme_colorbox_image_formatter($variables) {
'style_name' => $settings['colorbox_node_style'],
);
if ($variables['delta'] == 0 && !empty($settings['colorbox_node_style_first'])) {
$image['style_name'] = $settings['colorbox_node_style_first'];
}
if (isset($item['width']) && isset($item['height'])) {
$image['width'] = $item['width'];
$image['height'] = $item['height'];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment