New answers tagged

0

Using the twig_tweak module, I found I could use: <dd>{{ drupal_field('field_image', 'node') }}</dd>


4

You can use entityQuery: $fid = 13141; $usedIn = \Drupal::entityQuery('media') ->condition('field_media_image.target_id', $fid) ->execute(); Example response: Array ( [15105] => 13109 )


1

$media_id = \Drupal::request()->get('media'); // get value of media query param $media = Drupal\media\Entity\Media::load($media_id); // load the Media entity $media_name = $media->getName(); // get the media item name $media_field = $media->get('field_media_image')->first()->getValue(); // get media field $file_id = $media_field['target_id'...


0

In twig, we can get the path - <img src="{{ node.FIELD-IMAGE-NAME.entity.uri.value | image_style('news_image_full_width') }}" alt="">


Top 50 recent answers are included