Over the last several days, I've railed in my head against the matroshka structure of Drupal entities. But when I tried to break out some helper functions, and when I realized what each of the different properties each entity had, I realized the complexities of entities were warranted. Life is complex, and thus Drupal is complex. Entity references load a Media Entity, which load an Image from an image field, which load a File. The alt and title are on the Image, while the file URI is on the file…
Read more about Drupal 8: Get URI, Title, and Alt from Media Entity Reference ItemIt can take a minute to figure out what method to use to get the file URL from the file URI. Here's what I did: file_create_url($file_entity->get('uri')->getString()) Now, mind you, this requires a file entity. Function doc here. For details on getting that, see this…
Read more about Drupal 8: How to Get a File URL from a File URI like public://filename Suitable for img src