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.
Hey there,
Do you have plans to port this module to D8? I write a skeleton module (rough version) that provides this functionality and I was wondering what your plans were for this module in the future.
D
Comments
Comment #1
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedAt this point I myself don't have any plans to port this to D8 until I need it. That being said, it is open source, so if you've started to make progress on it, please post any patches here, thanks.
Comment #2
drupalfan2 CreditAttribution: drupalfan2 commentedIs there any other module or other solution for Drupal 8?
Comment #3
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedComment #4
spoit CreditAttribution: spoit commentedMarked #2775147: What about Drupal 8? as duplicate of this issue.
Comment #5
Echofive CreditAttribution: Echofive commentedHello everybody,
The first version compatible for Drupal 8 is available here:
https://www.drupal.org/sandbox/spoit/2806183
http://cgit.drupalcode.org/sandbox-spoit-2806183/tree/?h=wieni-8.x-1.x
Kind regards ;)
Echofive.
Comment #6
millionacrenest CreditAttribution: millionacrenest commented#5 works great, looks great. Thanks!
Comment #7
sachbearbeiter CreditAttribution: sachbearbeiter commentedThanks a lot - i will try to use it in the next project ...
Regards
SB
Comment #8
Ambient.ImpactI've gotten #5 working on Drupal 8.7.3, but I had to make some changes to fix some fatal errors:
@
which Symfony's YAML parsing chokes on.template_preprocess_image_formatter()
intotemplate_preprocess_image_caption_formatter()
as the former is in an include that's only loaded when needed, and does not get loaded if using a different formatter (i.e. the caption formatter). It's probably against Drupal best practices to run a specific preprocess function as well, since it bypasses the theme system and doesn't allow other modules to have their say.Comment #9
Ambient.ImpactAn update to my previous patch with a fix for a fatal error when _image_field_caption_widget_process runs during a Views Bulk Operations view.
Comment #10
fredonia_webteam CreditAttribution: fredonia_webteam commentedAre there any updates on this port?
Comment #11
dercheffeThis should be shipped with core media module IMO :)
Any news about this port?
Comment #12
Ambient.ImpactI've been using this for a while, but the more I've thought about it, the more I think that the way forward is to add a text field on the core image media entity, since media is the way forward for Drupal core. I think that's preferable and much more flexible than what this module does, which hard codes a single caption and has to set up storage for it, etc., which you get for free when you add fields to a media entity.
Comment #13
awm CreditAttribution: awm commentedI created a patch file based on #5. credit goes to https://www.drupal.org/sandbox/spoit/2806183
Comment #14
AaronBaumanAny reason not to tag an 8.x release from the sandbox project or the github project?
https://github.com/wieni/image_field_caption
Comment #15
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedWould anyone like to volunteer to be the D8 maintainer? Please DM me.
I figure that the sandbox/patch can be used as the starting grounds.
UPDATE: Please welcome ironsizide and awm as new maintainers!
Comment #16
awm CreditAttribution: awm commentedI noticed couple of issues that I fixed in the latest patch.
1. Required is not being set when using image fields with caption in paragraphs.
2. issues with multi-values image fields, when adding additional caption field in node form, the previous ones are being overwritten with empty value or being reset.
Comment #17
awm CreditAttribution: awm commentedpatch #17:
- cleaned up some code that does appear to be necessary
- fix issues with values disappearing in a multi-value fields
- handle required field setting in a similar fashion to how the core alt field is handled.
one issue remains is that when the format of the caption is html or full html, the required settings does not work.
Please test this as a single field, multivalue field, and a paragraph field .. would love some feedback.
Comment #18
awm CreditAttribution: awm commentedThis still needs some work:
1.Support revisions
2. Ensure the caption field work with multivalue setting.
3. Ensure the field work on paragraphs.
Attaching a patch that fixed issues with paragraphs.
Comment #19
awm CreditAttribution: awm commentedComment #20
awm CreditAttribution: awm commented@Ambient.Impact I agree with your comment I think I have seen some feature requests in core to add caption in addition to alt and title. In fact there are modules in some issues, (see below) , that allow the use of either "alt" or "title" as caption but non of them add a dedicated caption property to the image.
Ideally this module can be rewritten to to alter the core image and add the caption property instead of having the caption separated and handling the storage ourselves
relevant issues in core:
- https://www.drupal.org/project/drupal/issues/2305109
- https://www.drupal.org/project/drupal/issues/2768951
In any case, I created a new branch for 8.x-1.x based on the work gathered here. We need to update the project page to reflect the status of the module.
https://git.drupalcode.org/project/image_field_caption/commits/8.x-1.x
Comment #22
ironsizide CreditAttribution: ironsizide at Message Agency commentedI must admit I''m unclear as to what I should be doing as D8 maintainer at this juncture. This still needs work and not ready for a stable release yet, correct? Should I be the one updating the project page?
Comment #23
Ambient.Impact@awm Fair enough. Thanks for the links.
Hopefully the default template can also use
<figure>
and<figcaption>
elements rather than the<blockquote>
in spoit's port and generate the link with thelink()
Twig function so it can be altered. I have my own image-caption-formatter.html.twig that does just thatComment #24
Nelo_Drup CreditAttribution: Nelo_Drup commentedHello any news about this module for drupal 8, is it stable or even and is it recommended to use it?
Comment #25
Ambient.Impact@Nelo_Drup Looks like a stable release was made yesterday (yay!), but it's not installable because of an incorrect dependency.
Comment #26
Ambient.ImpactLooks like the 1.1 release fixed my previous comment and we now have a working, stable Drupal 8/9 version. Should this issue be closed now?
Comment #27
Wim Leers#12: I could not agree more!
So I created #3178369: Automatically migrate captions from the image_field_caption D7 module into an equivalent text field on the Image media type to make that happen 🤓 Feel free to help out!
Comment #28
Ambient.Impact#27: Awesome, thanks! I think my thoughts on the subject have gone back and forth since I posted that comment:
<figcaption></figcaption>
if we potentially have multiple images as an edge case? Is it valid HTML to have a<figure></figure>
with multiple images and one<figcaption></figcaption>
? I'm a bit short on time, so maybe someone can check the HTML spec here.Comment #29
iStryker CreditAttribution: iStryker at University of Waterloo commentedDont know why this ticket is still open. This was done. Drupal 8 is unsupported now and there is Drupal 10 release. Marking as fixed as this was actually done.
(FYI I have not read all the comments)