There is this view of which I configured the fields as follows:

Gallery images: exclude from display - Background: in cck, this is a separate image field with multiple values called 'Gallery images'

Title: default

Custom text:
- Exclude from display - No results behavior: Hide if empty checked + Hide rewriting if empty checked

Colorbox trigger: - trigger field: custom text - popup: [field_project_gallery_images] - No results behavior: Hide if empty checked + Hide rewriting if empty checked

This works nicely in itself, colorbox shows a nice slideshow after clicking on the custom text. The problem is that the colorbox trigger should only be output if there are actually images uploaded to the gallery images field. I other words, Hide rewriting if empty checked leaves me with no success.

Which isn't a surprise when dpm($fields). It shows the gallery images field as one chunk of HTML entirely instead of an array. dpm($fields) output comes down to the following if that makes sense:


$fields['colorobox']['content']['<span class="field-content"><a href="/en?width=100%25&amp;height=100%25&amp;inline=true#colorbox-inline-3" class="colorbox-inline" rel="">Meer foto's</a><div style="display: none;"><div id="colorbox-inline-3"><div id="field-slideshow-3-wrapper" class="field-slideshow-wrapper"> <div class="field-slideshow field-slideshow-3 effect-fade timeout-0 with-pager with-controls" style="width:680px; height:380px"> <div class="field-slideshow-slide field-slideshow-slide-1 even first"> <img class="field-slideshow-image field-slideshow-image-1" typeof="foaf:Image" src="http://multitech.id2r.net/sites/default/files/styles/colorbox_trigger/public/sd14-la-001_0.jpg?itok=8h7_PaP3" width="680" height="380" alt="" /> </div> <div class="field-slideshow-slide field-slideshow-slide-2 odd" style="display:none;"> <img class="field-slideshow-image field-slideshow-image-2" typeof="foaf:Image" src="http://multitech.id2r.net/sites/default/files/styles/colorbox_trigger/public/sd14-la-002_0.jpg?itok=as53SCju" width="680" height="380" alt="" /> </div> <div class="field-slideshow-slide field-slideshow-slide-3 even last" style="display:none;"> <img class="field-slideshow-image field-slideshow-image-3" typeof="foaf:Image" src="http://multitech.id2r.net/sites/default/files/styles/colorbox_trigger/public/sd14-la-003.jpg?itok=PtCO9nvK" width="680" height="380" alt="" /> </div> </div> <div id="field-slideshow-3-controls" class="field-slideshow-controls"> <a href="#" class="prev">Prev</a> <a href="#" class="next">Next</a> </div> </div> </div></div></span>']


No wonder there is no 0 to interpret as an empty field. This way, I can't loop through it and hide if count 0. To count the characters of the HTML would be way too dirty. But then, what can I do?

1 Answer 1


This is unfortunately just the way the colorbox module works.

Because it is possible to put any content in a views colorbox it is set up to handle anything in a very generic way, which means it doesn't handle single images in the most effective way and the trigger field way of configuring things is more complex than is needed in some cases.

I opened a similar issue about resizing the colorbox based on images, which you also cannot currently do because of the same issue of the way it has been implemented.

It is something I believe the module maintainer could fix though. I would recommend opening a feature request issue on drupal.org at https://drupal.org/project/issues/colorbox?categories=All

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.