Score:1

Best way getting video url for paragraph on a node with a field video (media core)

bd flag

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?

id flag
What do you mean by “better”?
Prestosaurus avatar
ve flag
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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.