I have a block with the media field video bundle (drupal 9) and it renders the video through the file-video.html.twig. I have copied template to my custom theme from core. What do i need is to override it but only for the block field as i'm using media fields quite a lot in my website

Is there any chance to preprocess theme suggestions for file-video.html.twig template?

  • Have you seen the Debugging Twig templates documentation?
    – sonfd
    Jun 5, 2022 at 18:56
  • @sonfd yes i have seen it. Template suggestions unfortunately not covering how to override media reference video template
    – Vitaliy K
    Jun 6, 2022 at 10:23
  • 1
    You can use hook_theme_suggestions_alter() to add your own template suggestions.
    – sonfd
    Jun 6, 2022 at 10:29
  • @sonfd it works only to : fields, media templates but not working to file-video template
    – Vitaliy K
    Jun 6, 2022 at 10:46
  • @sonfd theme_suggestions_file_video_alter worked... now thinking how to implement better
    – Vitaliy K
    Jun 6, 2022 at 11:24


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.