1

When I have a paragraph on a node with a field video (media core), is there another good practice to get the URL of the video?

I have this in the twig-file field--paragraph--field-video.html.twig:

file_url(item.content['#media'].field_media_video_file.entity.uri.value)

Or is there a better way in a field--paragraph--* file?

2
  • What do you mean by “better”?
    – cilefen
    May 13, 2023 at 16:49
  • Under "Manage display" for the Video Media type you can set the display to "URL to file". Does that work for you? If that doesn't fit, preprocessing would probably be better. By the time you get to .entity in Twig you can start bypassing some key processing features in Drupal May 14, 2023 at 3:03

0

Your Answer

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

Browse other questions tagged or ask your own question.