I want to edit the Media library module View to show the images Alt and Title field value, but it is not in the available fields (only "Thumbnail(alt)" which prints the image).

All available relationships also do not give alt or title.

It seems the Image settings fields are not available in views?

up vote 2 down vote accepted

alt and title are stored in field_media_image of the media type Image. To access the values in Views add this field to FIELDS and select/configure a field formatter to display the values.

To output the raw values outside of a formatted image rewrite the field and use the replacement patterns:

{{ field_media_image__title }}
{{ field_media_image__alt }}
  • Perfect! I added the field "Image" (of Category "Media") and then rewrote the result in the field itself with your replacement patterns, thanks! – petergus Nov 29 at 2:44

Not sure you'd easily get that info in a view.

Probably might need to do a hook_preprocess_media and add the content yourself as the view shows the rendered entity for the "media_library" display mode

Have a look at line 110 in the core/modules/media_library/media_library.module file and you'll see its doing a similar thing to add stuff to that rendered display

Or if you want this title to show just specifically for that view you could do an alter on that view

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.