Skip to content

Instantly share code, notes, and snippets.

View adamdelaney's full-sized avatar

Adam Delaney adamdelaney

  • University of Iowa - ITS
  • Iowa
View GitHub Profile
@adamdelaney
adamdelaney / media_responsive_image.php
Created November 21, 2018 16:56
Render responsive image from media entity reference field
$image_field = $paragraph->get('field_image');
if (!$image_field->isEmpty()) {
$image = $image_field->first()->getValue();
$media = Media::load($image['target_id']);
// Set display options.
$display_options = [
'label' => 'hidden',
'type' => 'responsive_image',
'settings' => [