Hi I am trying to use the custom caption option however the replacement patterns do not display the any token for the custom caption field I created.

The field is called teaser caption and I have tried [Content: Teaser Caption] I have also tried [field_teaser_caption].

Otherwise is it my misunderstanding that you can only use replacement patterns that are provided for the caption custom (with tokens) option.

#20 colorbox-views-replacement-patterns-1947796-20.patch580 bytesspacetaxi
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). View
#5 view.txt6.16 KBRoad Kill
Members fund testing for the Drupal project. Drupal Association Learn more


dpearcefl’s picture

So ColorBox captions can't use content from "Fields" fields?

dpearcefl’s picture

Status: Active » Closed (works as designed)

Found what appears to be an undocumented token:


This token may be implemented somewhere else, but it does work.

Road Kill’s picture

Thank you dpearceMN tried [node:field_name] but no joy I am thinking that maybe colorbox can not use custom tokens.

dpearcefl’s picture

Actually, yes it does work in ColorBox because I am using it. Why it doesn't work for you is another question.

Road Kill’s picture

Status: Closed (works as designed) » Active
6.16 KB

Hi that’s interesting if it is working for you but for my view the caption is not visible. I have attached the view you can take a look if you like maybe I have misconfigured it.

I used the following token [node:field_teaser_caption] based on the [node:field_name] token.

Road Kill’s picture

DpearceMN please keep in mind you can not change the status of an issue based on your circumstances and opinion Status: active » closed (works as designed) just because it works for you. There are many reasons why this could be working for you but not for me.

ManuV’s picture

garamani’s picture

same issue
there is no token available related to nodes or fields.
I'm using field collection for step by step articles. each step has an image and a title. Now I want to make an slideshow to visualize the article via Colorbox.
I've created the View, added fields and changed the image field formatter to Colorbox but there is no token available to add "step " title" as caption.
Tokens Avilable:

  • Current date
  • Current page
  • Random
  • Site information
  • Current user
  • Files

colorbox version: 7.x-2.4

lejonsson’s picture

I have also run inte this problem, no field tokens are available for the "Custom (using tokens)" caption option in Colorbox, only the tokes garamani listed above.

stewart.adam’s picture

Title: Custom caption field tokens » Colorbox does not show node related token in the custom caption replacement pattern browser
Version: 7.x-1.5 » 7.x-2.4
Category: Support request » Bug report
Issue summary: View changes

Updating issue status, can confirm with 7.x-2.4.

The node tokens are replaced, but do not appear in the token browser. Likely a small change in colorbox_field_formatter_settings_form() is required to pass the $node object to the token module.

Marko B’s picture

I can confirm the same problem. No node tokens or replacement patterns (for example other fields in View you have).

Marko B’s picture

Also, maybe this is another issue. Token list FILE tokens but when you try to access any of them you get empty results.

djh007’s picture

Can confirm that updating to Colorbox 7.x-2.7 does not fix this issues. No field tokens are visible in the caption replacement patterns, and trying to use a token that's not listed just result in "[token]" being outputted.

Any suggestions on how to get this to work?

djh007’s picture

The [node:token] approach seems to work for basic node tokens, but trying to use [node:image_alt] and [node:image_title] to use image metadata does not work.

Tried updating to dev. These tokens are not available to colorbox.

maxperience’s picture

Hi I came accross the same issue. My solution was to use the Colorbox Trigger field. Add this field to your view. You can then use the fields that come before this field (in your view) as a replacement token.

glkr’s picture

I used colorbox trigger field to display text fields as captions, too. However, clicking on image to display next image doesn't work with colorbox trigger. Is there a way to enable click on image to display next function with colorbox trigger?

clemens.tolboom’s picture

Version: 7.x-2.4 » 7.x-2.x-dev

As this is not solved in latest 7.x-2.7 let's change version to dev so the developer can review this bug.

kopeboy’s picture

Title: Colorbox does not show node related token in the custom caption replacement pattern browser » Views: Replacement patterns and node tokens are not replaced in caption
Component: User interface » Miscellaneous

Yes please, review this.
I cleaned the issue title..

How to use replacement patterns and/or node/field tokens in a Colorbox caption with Views?

If I select "Custom (with tokens)" as the caption, even the view fields' replacement patterns won't work.

chadsten’s picture

Is there any word on when this will be added to the module? Exposing just these global tokens really doesn't help what seems to be anyone.

spacetaxi’s picture

580 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). View

This patch adds the parent entities to the list of available tokens. It fixes a line which was calling the entity_type of the $instance, which appears to be 'ctools' in the view. I did not test with fields that appear in multiple entities, but should work.

spacetaxi’s picture

Status: Active » Needs review
fbreckx’s picture

I do see the tokens in the list, but the value doesn't apear under the picture.
Trying to display the node description as caption.

naero’s picture

spacetaxi, I tested your patch and it worked for me. Thank you!!

PrineShazar’s picture

@spacetaxi - Thank you, looks good. the $instance array would change based on where you would use the formatter, eg, if you change colorbox formatter settings on a node (content type) you will see the node tokens, but when used on a view, the $instance array passes 'ctools' entity type, which is correct but obviously not what theme_token_tree requires for node tokens.

What are the drawbacks of using the $field bundle value and why isnt this used by other field implementations instead of $instance? That would be my main concern about using this option.

akanik’s picture

Patch works great. Thanks so much!

Adrian83’s picture

#20 worked. Thank you @spacetaxi. This is a very simple one-line change that allowed the token browser to show tokens for my field collection items when I was trying to configure a custom caption for the Colorbox module in Views.

Notes for others on this trail: This patch simply allows the tokens to show in the token browser in views. The tokens work even without this patch. To see a list of available tokens without installing this patch, go to admin/modules >token and click on "help".

After using this patch to find my token, I removed it to see what would break if I ever updated Colorbox. The token continues to function even without this patch. In my case I had been using my alt text for my caption, but I wanted to prepend the alt text with a unique picture id. Here are the tokens that worked for me: #[file:fid] - [field_collection_item:field-NAME:0:alt]

gajanannehul’s picture

#20 worked for me too.

Thanks spacetaxi.

  • frjo committed d7a4de7 on 7.x-2.x authored by spacetaxi
    Issue #1947796 by spacetaxi: Views: Replacement patterns and node tokens...
frjo’s picture

Committed patch #20 to 7.x-2.x. Thanks contributing and testing this!

frjo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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