Image alt and title tokens are unavailable in the Colorbox caption options, so it doesn't seem possible to build a caption using image meta information. See https://www.drupal.org/node/1947796

The tokens work with Colorbox trigger, but using [nid] in the Custom Colorbox Gallery does not limit the gallery by node, but shows all images in the query. See https://www.drupal.org/node/1779834

Any suggestions on how to make this work?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

partdigital’s picture

I ran into the same problem, it was caused by this found in colorbox_handler_field_colorbox.inc

$gallery = drupal_html_class($this->options['custom_gid']);

It was stripping out all tokens before they could be substituted. I fixed it with this patch.

partdigital’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: tokens-unavailable-to-colorbox-2319483.2.patch, failed testing.

Sill’s picture

FileSize
944 bytes

This had me stumped for way too long... It definitely strips off the tokens. The technical parts of the patch above worked great, so I've tried to rework the patch. Hopefully this works.

Sill’s picture

Status: Needs work » Needs review
partdigital’s picture

I can confirm this works. I've updated the patch to remove some commented out code.

partdigital’s picture

Status: Needs review » Reviewed & tested by the community
frjo’s picture

Status: Reviewed & tested by the community » Fixed

Thanks fro the contribution!

Committed to 7.x-2.x with a very minor change.

  • frjo committed 5c27b83 on 7.x-2.x authored by partdigital
    Issue #2319483 by partdigital, Sill: Tokens unavailable to Colorbox and...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.