Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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.
Comment | File | Size | Author |
---|---|---|---|
#20 | colorbox-views-replacement-patterns-1947796-20.patch | 580 bytes | spacetaxi |
Comments
Comment #1
dpearcefl CreditAttribution: dpearcefl commentedSo ColorBox captions can't use content from "Fields" fields?
Comment #2
dpearcefl CreditAttribution: dpearcefl commentedFound what appears to be an undocumented token:
This token may be implemented somewhere else, but it does work.
Comment #3
Road Kill CreditAttribution: Road Kill commentedThank you dpearceMN tried [node:field_name] but no joy I am thinking that maybe colorbox can not use custom tokens.
Comment #4
dpearcefl CreditAttribution: dpearcefl commentedActually, yes it does work in ColorBox because I am using it. Why it doesn't work for you is another question.
Comment #5
Road Kill CreditAttribution: Road Kill commentedHi 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.
Comment #6
Road Kill CreditAttribution: Road Kill commentedDpearceMN 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.
Comment #7
ManuV CreditAttribution: ManuV commentedComment #8
garamani CreditAttribution: garamani commentedsame 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:
colorbox version: 7.x-2.4
Comment #9
lejonsson CreditAttribution: lejonsson commentedI 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.
Comment #10
stewart.adam CreditAttribution: stewart.adam commentedUpdating 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.Comment #11
Marko B CreditAttribution: Marko B commentedI can confirm the same problem. No node tokens or replacement patterns (for example other fields in View you have).
Comment #12
Marko B CreditAttribution: Marko B commentedAlso, maybe this is another issue. Token list FILE tokens but when you try to access any of them you get empty results.
Comment #13
djh007 CreditAttribution: djh007 commentedCan 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?
Comment #14
djh007 CreditAttribution: djh007 commentedThe [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.
Comment #15
maxperience CreditAttribution: maxperience commentedHi 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.
Comment #16
glkr CreditAttribution: glkr commentedI 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?
Comment #17
clemens.tolboomAs this is not solved in latest 7.x-2.7 let's change version to dev so the developer can review this bug.
Comment #18
kopeboy CreditAttribution: kopeboy commentedYes 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.
Comment #19
chadsten CreditAttribution: chadsten commentedIs 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.
Comment #20
spacetaxi CreditAttribution: spacetaxi commentedThis 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.
Comment #21
spacetaxi CreditAttribution: spacetaxi commentedComment #22
fbreckx CreditAttribution: fbreckx commentedI do see the tokens in the list, but the value doesn't apear under the picture.
Trying to display the node description as caption.
Comment #23
naero CreditAttribution: naero commentedspacetaxi, I tested your patch and it worked for me. Thank you!!
Comment #24
PrineShazar CreditAttribution: PrineShazar commented@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.
Comment #25
akanik CreditAttribution: akanik commentedPatch works great. Thanks so much!
Comment #26
Adrian83 CreditAttribution: Adrian83 commented#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]
Comment #27
gajanannehul CreditAttribution: gajanannehul as a volunteer and at Clarion Technologies commented#20 worked for me too.
Thanks spacetaxi.
Comment #29
frjo CreditAttribution: frjo commentedCommitted patch #20 to 7.x-2.x. Thanks contributing and testing this!
Comment #30
frjo CreditAttribution: frjo commented