0

I see this is done for an image field in the Manage Display options, but can't find this option for Entity Reference fields for Media (Image) with Rendered entity as the format. This affects Largest Contentful Paint, so I would love to be able to set this per Entity Reference field in a content type just like it's done with image fields. I can recreate the image tag through template files and preproccess hooks, but it seems like this should be possible through the UI.

entity reference field for media (image): entity reference field for media (image) vs. regular image field showing loading option regular image field shows loading option

4
  • You can set this in the Manage Display options for media entities. Then use "Rendered Entity" and that Display mode in the Manage Display options for your media field on the host entity (node, paragraph,..)
    – Hudri
    Commented Mar 3 at 8:42
  • I may be misunderstanding you, but I do not see any option for loading anywhere under display options for this field. The question was specifically asked for Drupal 9, which may handle this differently from Drupal 10, but the question was edited to remove this stipulation. I'll add screen captures to the original question.
    – C0c0b33f
    Commented Mar 4 at 20:44
  • I think I see what you are pointing to @Hudri, but I don't want all media of that type to load one way. I would like to have one media type for images and specify how they load per content type, not media type. For testing, I created a new media type for this content type only, but existing images did not change their loading setting per the new one–only if I changed the original media type.
    – C0c0b33f
    Commented Mar 4 at 21:19
  • 1
    Create multiple media display modes and vary the eager/lazy loding per display mode.
    – Hudri
    Commented Mar 4 at 21:39

1 Answer 1

0

I found the answer. If you select Thumbnail as the Format under Manage Display, you can then select the gear to the right and any image style you have. Underneath that is the loading eager/lazy preference options. This does not mean that Hudri is incorrect. I didn't want to create multiple media display modes, so this was what I was looking for as described https://www.youtube.com/watch?v=3kx3BLDCd2Y

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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