Drupal 7 Colorbox

When you have core 'image' field on your node type and you want to output 'title' (or 'alt') of this image just under the image thumbnail as text - you can use imagecaptionformatter module for that.
But only in the case when you don't need another image formatter in place - e.g. Colorbox - because Colorbox provides its own image formatter, and imagecaptionformatter module also provides its own image formatter. You obviously can't use two formatters at the same time.

Drupal 7 Colorbox

So, when I was asked to set up such image caption for Colorbox multiple image field, I had to spend a bit of time to find better way.

For Colorbox case, it's just the matter of one theme call override!

Colorbox for Drupal 8 Colorbox for Drupal 8 is a image field formatter and nothing more, or less. The extra features like colorboxload and colorboxinline can be found in contrib. Colorbox for Drupal 7 Installation for Drupal 7 Download and install the Libraries API 2 module and the Colorbox module as normal. Then download the Colorbox plugin. While working with a project, I need to display a view in colorbox popup. I have done the following steps for processing popup for views. You may also look into other solved issues and details related to colorbox over here. A port of the Colorbox Drupal 7 module to BackdropCMS Resources. GPL-2.0 License Releases 2. 1.x-2.10.0 Latest May 22, 2017 + 1 release.

Drupal 6 is very good. But Drupal 7 is even better. Much cleaner user interface (UI), and much cleaner application programming interface (API) as well. Today, I'm going to talk about Colobox integration in Drupal 7. With Colorbox in D7, you can show your attached images in a very user-friendly (and nice looking manner). Let's say you want to enhance the 'Article' content type with Colorbox. Once you click one of the three photos on the page, it opens up the colorbox, which allows you to click through all 12 photos. Is this possible with Colorbox and Drupal 7? EDIT: I'd like this to be a fix that I can use on a lot of different pages with varying numbers of photos. Sorry for the ambiguity.

Colorbox module has themecolorboximagefield() function, and here is the modified version of the function (1 line change) that you need to put to your theme:

'hide') { $image = '; $class[] = 'js-hide'; } else if (!empty($variables['image']['style_name'])) { $image = theme('image_style', $variables['image']); } else { $image = theme('image', $variables['image']); } // ##### Here are the lines I've added $my_style = 'my_style_that_should_come_with_a_caption'; if ($variables['image']['style_name'] $my_style) { $image .= ' . check_plain($variables['title']) . '; } // ##### end of modification $options = array( 'html' => TRUE, 'attributes' => array( 'title' => $variables['title'], 'class' => implode(' ', $class), 'rel' => $variables['gid'], ) ); return l($image, $variables['path'], $options); } ?>

Super-easy! But I hope this post may save several minutes for somebody :)

Drupal 7 Colorbox Libraries

Note that if you want to output 'alt' of the image, not 'title', you should change $variables['image']['title'] to $variables['image']['alt'].

Drupal 7 Release

UPD: some code improvements, from fietserwin