This is a utility which lets you reference a module by alias instead of ID. This is important if you have a deployment process with multiple stages, databases and systems that do not ultimately share the same module ids.
The DCA of tl_module is extended by a field "alias".
- Contao 4.13+
- PHP 7.4 or 8.0+
$ composer require guave/insertmodulebyalias-bundle
To load a module you can use the following syntax in your templates:
{{insert_module_alias::modulealias}}
If you need modules for specific languages, add the language to the alias like _en
and then load it in your template
with:
{{insert_module_alias::modulealias_en}}
Since Contao 4.13 you can also create a "Root page dependent Modules" Module. There you can select which module should be loaded for each root page.