Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
The caption dissapears when I change display mode from image to colorbox.
Comment | File | Size | Author |
---|---|---|---|
#39 | image_field_caption_colorbox-1913352-39.patch | 1.63 KB | raywalters |
#37 | image_field_caption_colorbox-1913352-36.patch | 2.91 KB | Anybody |
Comments
Comment #1
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedSorry, this module only works with the 'Image' display format for image fields. I haven't yet tried Colorbox, I'll try it sometime and see if I can get the caption to work with it.
Comment #2
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedComment #3
Bernsch CreditAttribution: Bernsch commentedHy Tyler! Thanks for this nice module! :-)
I would also like to use with Colrobox ;-). I hope it will work soon.
Comment #4
marshallexcavating CreditAttribution: marshallexcavating commentedAlso, Thanks for this nice module! :-)
I would also like to use with Shadowbox module. Same problem as with Colrobox.
Comment #5
tyler.frankenstein CreditAttribution: tyler.frankenstein commented@marshallexcavating, I've added a separate issue for shadowbox support: http://drupal.org/node/1928348
Comment #6
maxiorelNot ideal solution, but works: I've copied out function theme_colorbox_image_formatter($variables) {} to my template.php and renamed it to function MYTHEME_colorbox_image_formatter($variables) {}. Then to the last line with return theme(...) added
.'<div class="caption">'.$item['caption'].'</div>';
Comment #7
vgutekunst CreditAttribution: vgutekunst commented@maxiorel
can u plz describe ur changes again (for dummies like me :) ) which template.php i have to change?
or can u make a patch?
regards
Comment #8
Bernsch CreditAttribution: Bernsch commented@maxiorel
Pleace paste your code for the template.php here. :-) Thanks!
Comment #9
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedI have added support for the Colorbox module (http://drupalcode.org/project/image_field_caption.git/commit/bfe7cca) by providing a token for the caption:
[file:caption]
Update to the latest dev version of the module (http://drupal.org/project/image_field_caption) and flush your caches to get the token, or wait until the 7.x-1.1 version of this module comes out.
Here is how to set up the Image Field Caption token for use with Colorbox:
Comment #10
Dawn CreditAttribution: Dawn commentedI am looking for a way to allow an end user to add italics to just a portion of the caption. CSS would not be suitable, but rather a text formatter of some sort. I've tried a number of Modules including Image Caption Formatter, but no success so far with Colorbox. I have separate captions on the thumbnails and large images. I have achieved getting italics to show with just html italic tags in the caption that accompanies the thumbnail, but not over the large image where I need it.
Any help with this issue would be very appreciated. My site is not public, but I can send a link if it would be helpful.
Thanks.
Comment #11
tyler.frankenstein CreditAttribution: tyler.frankenstein commented@Dawn, this should be a separate issue because it is completely different than what is already being discussed here.
Comment #12
Bernsch CreditAttribution: Bernsch commentedThe
[file:caption]
token works with colorbox-field-formatter but the display-settings on my contentype doesent works correctly.The
[file:caption]
token text always show in teaser-node but not on my full node.When i am create a full-node display and use the
[file:caption]
token, the caption-text does not show in my full-node view - only in my teaser-view! In my manage displays settings for my contenttype i use not a colorbox-field-formatter on my teaser-view!Should we open a new issues for this problem?
Comment #13
Bernsch CreditAttribution: Bernsch commented[file:caption]
tokens also doesn't work in 2.x branche ...Comment #14
hanoiithe token was removed, and the caption is not associated wiwth the file no more but rather with the entity, token support, differently, has to be properly added.
Comment #15
hanoiiI have spent a considerable time on this and I don't see it included in this module. Here are my reasons:
I could do something similar to the file token attempt done by tyler on the 1.x branch, however, the 1.x branch was storing the caption associated with a file, which caused a lot of different issues.
By looking at the colorbox module, I could still use the file token as before, only because colorbox send a similar file object to the token function, although it's not really a file object. By defining a file token such as this, it will only work for the colorbox module, and the file token will appear for other file token uses and I think it can add confusion, still think it I might add this at some point but I will explore other options and I don't have that much time right now.
Also, there's another issue here, because doing it either way, the colorbox module expects the caption to be on the title tag of the image for it to work, and because this module now accepts any filtered text (such as HTML) this may cause extra issues.
I am going to posponed this for now, mainly because if you really need colorbox support, you can override the colorbox formatter theme implementation in your theme and do as needed.
I submitted this to #2014853: Caption alterers colorbox, if accepted I might work something out following that idea.
Comment #16
hanoiiAlso, bear in mind that you can use the title tag for the colorbox caption and leave the caption field to be used somewhere else. You can also override the colorbox formatter to show the html caption on the code.
Comment #17
hanoiiRelated to #2013124: Fancybox module support
Comment #18
hanoiiThere's also the fact that to add the caption as an HTML to the full view, colorbox has its own formatter which means unless you override again the formatter, it's not really the work of this module to support colorbox or other lightbox alternatives.
I suggest add a feature request in the colorbox module to support this module's caption. That might be easier or even better that the other way around.
If you do please realate it here.
Comment #19
hanoiiComment #20
AaronBaumanHere's how i exposed image_field_caption tokens for my own project, in case anyone else needs this functionality:
Comment #21
Road Kill CreditAttribution: Road Kill commentedHi is there away to get his caption field to pull through in views in a slideshow with images.
Comment #22
Road Kill CreditAttribution: Road Kill commentedSorry my bad I see it pulls through automatically :) nice
Comment #23
corkis81 CreditAttribution: corkis81 commentedHi, I have read several pages of tokens but I know little about php.
I tried to use #20 but I'm not sure how to implement colorbox.
could someone help me to create the files or module right?
Thank you so much
Comment #24
ardarvin CreditAttribution: ardarvin commentedI'm using 2.x branch. Hopefully this helps someone. I have a content type of "portfolio" with an image field machine name "field_portfolio_content_image" which can take in multiple images. I have a custom node---portfolio.tpl.php for this. As I want to display each image as a "lightbox" I can't simply:
render($content['field_portfolio_content_image']);
which works fine, but I can't get my lightbox. It took some time, but I found how to force the comment to display:
<?php echo $node->field_portfolio_content_image['und'][$img_count]['image_field_caption']['value']; ?>
the key is ['image_field_caption']['value']. Code in context looks like this:
Comment #25
neomen CreditAttribution: neomen commentedHi guys.
For myself, made a small fix. Maybe they will be useful to someone else.
Comment #26
bellagio CreditAttribution: bellagio commented#25 works great. thank you!!
Comment #27
Bernsch CreditAttribution: Bernsch commentedComment #28
iStryker CreditAttribution: iStryker commentedDo not like this method. like https://www.drupal.org/node/2345635#comment-9706103
Instead of overwritten the colorbox_image_formatter, we create our own formatter called 'Colorbox with caption'.
Plan to finish this today as I need it for a project I am working on.
Comment #29
Shane Birley CreditAttribution: Shane Birley as a volunteer commentedIs this code ready?
Comment #30
iStryker CreditAttribution: iStryker commented@Shane the code in the patch hijacks colorbox theme registry. This allows it to work. You may use it, but know that this solution will not be commit.
Comment #31
Shane Birley CreditAttribution: Shane Birley as a volunteer commentedAnyone need help with this? It would be an awesome feature to release.
Comment #32
vistree CreditAttribution: vistree commentedHi,
#25 works great - even with html enabled. I needed to change it a little bit to work with current 2.1-dev-11 version - but the result is amazing!
Why not to commit it? It checks for existing colorbox - so it is safe if colorbox is not installed ....
Comment #33
Leagnus CreditAttribution: Leagnus commented#20 is good for module_name.tokens.inc – it adds custom token to "manage/Your_type_of_material/display" > Colorbox format for a field > Caption > Custom (with tokens).
Its for CB lightbox` captions.
#25 works great for image_field_caption 7.x-2.1 – it adds the caption into blockquote html tag below an image.
Its for full node page.
Comment #34
thomas.frobieter+1 for patch #25 caption is working with the colorbox formatter now - thx!
Comment #35
AnybodyTested and re-rolled patch from #25. Patch against latest 7x.-2.x-dev attached. Thank you all. Please confirm RTBC.
Comment #36
AnybodyNew patch including #20 + #25 so now we have the token: [file:image_field_caption] available for colorbox subtitle PLUS working caption below preview images. Made for 7.x-2.x-dev!
Working perfectly for us. Please review.
Comment #37
AnybodyComment #38
heliogabalTested patch #36 with 2.2 (which is basically the same as dev):
1. First I got the following error:
2. When I added an empty line to the end of the patch, it applied cleanly.
3. I get the caption on the default node view with the colorbox field formatter now, that before only worked with the image formatter. So first part of the patch is working for me.
4. To also have the caption on the opened colorbox, I had to select Subtitle: Custom (with tokens) on the colorbox field formatter, and put
[file:image_field_caption]
into the custom subtitle field. So second part of the patch also working.5. Of course, with the token substitution, I lose all my formatting from the image_caption_filter field, but that's out of scope for this issue, I guess.
Comment #39
raywalters CreditAttribution: raywalters commentedThis patch keeps the image caption field when using colorbox.
Comment #40
raywalters CreditAttribution: raywalters commentedComment #41
ZapevalovAnton CreditAttribution: ZapevalovAnton as a volunteer commentedPatch #39 not work for me.(((
Comment #42
AnybodyThe patch from #37 doesn't apply anymore, but definitely worked for me with 7.x-2.1+12-dev. It needs a reroll against the latest dev.
#39 misses the module check for example... I think #37 is a better starting point. #38.5 should be handled in a separate issue I think.
Comment #43
iStryker CreditAttribution: iStryker commentedMarking all 7.x as out of date. If the problem persists, then only a new issue.