Drupal 8 || 9 || 10 - TWIG templates: Getting files in taxonomy terms media fields from a Drupal node
Sometimes, we have to build a file download button from a twig template. This can be done in many ways, but one of the most common use cases is to implement it directly from a twig template specific to that content type.
This gist covers a small and very specific use case where the file is part of a media type field present in a taxonomy term that is used in nodes of a content type: to extract the file path and form the download button path, we must traverse several levels..
- David Rodríguez, @davidjguru.
- Github main profile: https://github.com/davidjguru.
- Contact at [email protected]
- Website: https://therussianlullaby.com
- Drupal.org profile: https://www.drupal.org/u/davidjguru
- Linkedin profile: https://www.linkedin.com/in/davidjguru
- Sketchbook, english: https://davidjguru.github.io
- Medium, spanish: https://medium.com/@davidjguru
- Snippets: https://gitlab.com/users/davidjguru/snippets
- Dev.to: https://dev.to/davidjguru