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() { ...@@ -44,6 +44,7 @@ function colorbox_theme() {
'node' => NULL, // Left for legacy support. 'node' => NULL, // Left for legacy support.
'field' => array(), 'field' => array(),
'display_settings' => array(), 'display_settings' => array(),
'delta' => null,
), ),
'file' => 'colorbox.theme.inc', 'file' => 'colorbox.theme.inc',
), ),
...@@ -256,6 +257,7 @@ function colorbox_field_formatter_info() { ...@@ -256,6 +257,7 @@ function colorbox_field_formatter_info() {
'field types' => array('image'), 'field types' => array('image'),
'settings' => array( 'settings' => array(
'colorbox_node_style' => '', 'colorbox_node_style' => '',
'colorbox_node_style_first' => '',
'colorbox_image_style' => '', 'colorbox_image_style' => '',
'colorbox_gallery' => 'post', 'colorbox_gallery' => 'post',
'colorbox_gallery_custom' => '', 'colorbox_gallery_custom' => '',
...@@ -285,6 +287,14 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $ ...@@ -285,6 +287,14 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
'#options' => $image_styles_hide, '#options' => $image_styles_hide,
'#description' => t('Image style to use in the content.'), '#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( $element['colorbox_image_style'] = array(
'#title' => t('Colorbox image style'), '#title' => t('Colorbox image style'),
'#type' => 'select', '#type' => 'select',
...@@ -415,6 +425,10 @@ function colorbox_field_formatter_settings_summary($field, $instance, $view_mode ...@@ -415,6 +425,10 @@ function colorbox_field_formatter_settings_summary($field, $instance, $view_mode
$summary[] = t('Content image style: Original image'); $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']])) { if (isset($image_styles[$settings['colorbox_image_style']])) {
$summary[] = t('Colorbox image style: @style', array('@style' => $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, ...@@ -466,6 +480,7 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
'#node' => $entity, // Left for legacy support. '#node' => $entity, // Left for legacy support.
'#field' => $field, '#field' => $field,
'#display_settings' => $display['settings'], '#display_settings' => $display['settings'],
'#delta' => $delta,
); );
} }
} }
......
...@@ -30,6 +30,10 @@ function theme_colorbox_image_formatter($variables) { ...@@ -30,6 +30,10 @@ function theme_colorbox_image_formatter($variables) {
'style_name' => $settings['colorbox_node_style'], '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'])) { if (isset($item['width']) && isset($item['height'])) {
$image['width'] = $item['width']; $image['width'] = $item['width'];
$image['height'] = $item['height']; $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