media_entity_twig
The Media Entity Twig module provides a powerful way to add Twig templates, content and components as media items that can be re-used anywhere you can add media.
This can be useful if you've built interactive components that you want to feature instead of more traditional media such as images and video.
This module is designed for Drupal 10.3+ and is ideal for theme developers, frontend engineers, site builders and anyone needing to add twig things to be used and reused as media items.
Usage:
- Require the module into your project via Composer:
composer require drupal/media_entity_twig. - Enable the module in the UI:
/admin/modules#module-media-entity-twigor via drush:drush en media_entity_twig - Go to media types
/admin/structure/mediaand you will see a new media type called Twig. - A default twig field is automatically added with default field settings. You can now customise or add additional fields at
/admin/structure/media/manage/twig/fields - You can now add media of type twig in addition to the default media types such as image and video.
Additional Requirements
This module requires Drupal's core image, media, media_library, and path modules as well as the contrib module twig_field.
Community Documentation
I will provide a YouTube walkthrough of the functionality this module provides soon!
Supporting organisation
Pivale are a globally trusted web development company who build Drupal CMS websites and software.