If you insert a picture into the tabs, it is not marked as being used in the system.
The /admin/content/files section will show 0 places and the file is marked as temporary and will be deleted 6 hours after the cron run.
Steps to reproduce
1. Create a content type with a body field and horizontal tabs field.
2. Set the full HTML editor to CKEditor 5.
3. Create a new content, setting both body and horizontal tabs body field as Full HTML.
4. Insert an image using CKEditor on both body and horizontal tabs field. (in the example, A is in the body, B is in the horizontal tabs.
5. Save (published or not, it does not matter)
6. Check the Files (/admin/content/files), the image uploaded in the horizontal tabs field is set to "Temporary" even though it's being used.
Expected outcome:
Both A and B are marked as "Permanent"
Actual outcome:
A is marked "Permanent" while B is marked "Temporary"
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Screenshot 2024-09-09 224146.png | 67.31 KB | wilhansen |
| #4 | Screenshot 2024-09-09 224023.png | 112.31 KB | wilhansen |
Issue fork bootstrap_horizontal_tabs-3392320
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mark_fullmerThanks for reporting this! Can you provide more information about how you are inserting the image into the tabs, such as enumerated steps to reproduce? On the surface, it's not clear to me how this module's code would be responsible for the problem described.
Comment #3
mark_fullmerComment #4
wilhansen commentedI am able to replicate it:
Drupal: 10.3.2
bootstrap_horizontal_tabs version: 2.0.7
Steps:
1. Create a content type with a body field and horizontal tabs field.
2. Set the full HTML editor to CKEditor 5.
3. Create a new content, setting both body and horizontal tabs body field as Full HTML.
4. Insert an image using CKEditor on both body and horizontal tabs field. (in the example, A is in the body, B is in the horizontal tabs.
5. Save (published or not, it does not matter)
6. Check the Files (/admin/content/files), the image uploaded in the horizontal tabs field is set to "Temporary" even though it's being used.
Expected outcome:
Both A and B are marked as "Permanent"
Actual outcome:
A is marked "Permanent" while B is marked "Temporary"
Why is bootstrap_horizontal_tabs probably the place to file: CKEditor image upload works fine as a standalone field but not when under bootstrap_horizontal_tabs. Issue is probably additional steps needed when handling body content in the forms in order to register file usage to drupal.
Comment #5
wilhansen commentedThe bug is probably due to this field inheriting from FieldItemBase. In order for the editor module to recognize the uploaded files, the field should inherit from TextItemBase as stated in https://api.drupal.org/api/drupal/core%21modules%21editor%21editor.modul...
Comment #6
wilhansen commentedRelated issue https://www.drupal.org/node/2732429
Other modules (such as faqfield referencing the same issue) are having the same problems.
I implemented the hack that faqfield did (https://git.drupalcode.org/project/faqfield/-/merge_requests/6/diffs?com...) and on BootStrapHorizontalTabs.php and it fixed this issue.
Comment #7
hommesreponse commented@wilhansen could you let us know where inside BootStrapHorizontalTabs.php to apply the hack. I saw what they did in the faqfield module but couldn't quite figure out how it applies in this module. Forgive me for my ignorance.
Thanks!
Comment #8
wilhansen commented@hommesresponse here's the diff:
Comment #9
hommesreponse commented@wilhansen Thanks so much!
Comment #11
mark_fullmerComment #12
mark_fullmerComment #13
mark_fullmerThanks for the steps to reproduce. I was able to reproduce this *only* with the direct image upload; the Media Library upload set the image file to Permanent.
I tested these changes to confirm that they would not conflict with or require database schema changes for existing fields. Everything checked out. If someone else could review, that'd be great.
Comment #14
mark_fullmerMerged, and marking as Fixed. Thanks everyone for your contributions!