Alt text is not inserted (nor available to template) with core image field

Created on 1 June 2020, over 4 years ago
Updated 1 March 2023, almost 2 years ago

I'm trying to configure my site (which was upgraded using Migrate Drupal from 7 to 8) to have images inserted into the body.

I have an 'Image' field added to my content type.
I configured the Insert form display settings to allow Inserting the "Original" image.
When I insert an image (which has a required Alt text field), the resulting markup doesn't contain the alt text.

In fact, I overrode the template entirely and printed {{ alt }}, and it was empty. I then overrode the theme preprocess hook to check what data was available, and I could see that the File entity was loaded and available, but if I tried doing a $vars['file']->get('alt'); on it, it would not load any alt text and my site had the WSOD.

I'm kind of scratching my head... the field is a core image field:

But when I try to insert it, there is just the src (which is correct), width/height (though they are not taking into account my 'max insert width' setting as noted in #3144269: Maximum image insert width setting not applying when inserting original image β†’ ), and all the data-src attributes with the file UUID and such. No alt text.

πŸ› Bug report
Status

Closed: cannot reproduce

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States geerlingguy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024