Problem/Motivation
We cannot display the Alt or Title Text as a caption, when the juicebox-field is referenced to media entity.
Steps to reproduce
- Add a Media Entity with a Image field.
- Create a Paragraph Entity and add a Field Reference to the Media Entity (unlimited)
- Add the field format juicebox at /admin/structure/paragraphs_type/{type}/display
- Edit the field settings: Only the Option "No Caption" and "File - Filename (processed by fallback text format)" will be available under Caption Source
Is this a missing feature or a bug?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | juicebox-caption-source-options-3228340-9.patch | 780 bytes | handkerchief |
Comments
Comment #2
fkelly12054@gmail.com commentedI started to investigate this. As a preliminary I have run a file comparison on 8.x-3.0-alpha2 and 8.x-3.x-dev. Both were released on December 20, 2020 but I wanted to confirm that they were substantially identical. They are. The only differences are version numbers in several yml files. So any testing I do on the alpha2 release will apply to the dev release as well.
I haven't activated the media module yet ... that's next. Humm ... reading your description @handkerchief it appears you have the paragraph module activated? What version? I'll have to install that also I guess to test this. I'll start with the latest paragraphs. I don't use that on my sites.
It could very well be a "bug" or at least something we never thought of testing.
Comment #3
handkerchiefThank you very much fkelly.
Yes we use paragraphs.
The versions:
- Paragraphs: 8.x-1.12
- Drupal Core: 9.2.4
- Juicebox: 8.x-3.0-alpha2
Comment #4
fkelly12054@gmail.com commentedI have the modules you listed installed locally and have activated media and media library.
I'm having a devil's time getting ckeditor configured properly: keep getting "You must configure the selected text editor" when trying to set up full html text format. Using restricted html format type, I can get as far as embedding a media item in an article content type. If it's an image item, then on the manage form display screen under structure/content types for "article" I get:
"Widget settings: Image"
"Preview image style" ... with a series of formats including several Juicebox "styles" in a drop down box
"The preview image will be shown while editing the content"
in the third column of manage form display.
There is no such choice with a media item. Somehow a media widget or some such would have to be connected up the way the image widget is to allow the use of Juicebox formats.
Historically Juicebox was developed at a time when no one knew anything about a core media module or media library. I'm not sure what we would have to do to connect the two. I'm kind of stuck until I figure out what's wrong with ckeditor and setting up the full html format.
Comment #5
handkerchiefThank you very much for your work.
I'm confused about the part with the CKEditor. Because we don't use one in this specific gallery setup. Why/where do you use CKEditor for this? A Field Reference to the Media Entity would also do the job. Or am I missing something?
Technically it should not be a problem to get the informations, even if a referenced media entity is involved. At the time when the module didn't support media entities, we copied and modified the field formatter just a little bit to get this work with media entities, and also with the captions. See my original summary: https://www.drupal.org/node/2996745/revisions/11098502/view #2996745: Add support for fieldable file entities and/or media entities
So the field formatter has to check if the field is a reference to a media entity or a direct reference to the image field. So the selecting path is a little different, in my opinion, that's all.
Comment #6
handkerchiefComment #7
fkelly12054@gmail.com commentedI will look at the parent issue you referenced. I was initially just trying to get the media module (and media library) working on my local and "production" systems. So, I started with what I had. I use ckeditor to create content items (articles and a content type I call Juicebox Gallery where I embed galleries). I thought I needed the ckeditor upload image module. However I ran into PHP errors when I had that installed and when I tried to save ckeditor full html text format changes. I've posted that in the ckeditor upload image issue queue. When I removed the upload image module from my local system the problem disappeared. I think I need to redo the installation process for that module using some composer instructions they've posted.
Just read the parent issue. It appears we may have the patch you posted a couple of years ago already incorporated into our alpha version of Juicebox. See #28 in https://www.drupal.org/project/juicebox/issues/2996745. So, we may be further along this path than I thought. I'll start by verifying that the patch is in the alpha version and familiarizing myself with how it works. But I need to do something about upload image first because it is disrupting my normal workflow.
Comment #8
handkerchiefThanks fkelly for your effort. I think I found the bug. It is now working.
Comment #9
handkerchiefWrong patch format in #8. So here is the correct one.
Comment #10
fkelly12054@gmail.com commentedI just applied the patch manually to both my test (Wampserver based) and my production (live dangerously) systems. I don't have any test cases yet but I'll try to find one.
Assuming we can make this RTBC we will want to consult with Neslee about what's next. If I'm not mistaken, issue 3189036 (Broken Functional tests) is the only thing standing between us and at least a beta release. Neslee and DK40 were working on 3189036 last December (2020). I'm not familiar with the testing infrastructure that much but am willing to chip in if I get some guidance from one of those gentlemen.
Edit: occurs to me that most folks using Juicebox for Drupal 8 are going to want to get to the Drupal 9 version (the current alpha release) by December of this year. Drupal 7 will live on another year but I suspect most using that will want to get to Drupal 9 pretty soon too. It would be good to be working towards a stable release and have at least a beta by December.
Comment #11
handkerchiefok thanks. it would be great if this little bugfix could be commited as soon as possible.
Comment #12
fkelly12054@gmail.com commentedI am making this RTBC. I've been running it on the alpha version for over a week. Alpha is the same as the dev. version.
In another issue I have mentioned that we should fix the tests and get the alpha version to beta. We'll need our maintainer to look at the bigger picture and get the necessary commits done.
Comment #13
fkelly12054@gmail.com commentedCleaning up issues. This rtbc issue is in the Drupal 10 code going forward. I am marking it fixed.
Comment #15
redeight commentedAny chance we can get an Alpha 3 with this in it?