guave / insertmodulebyalias-bundle
通过别名插入模块 - Contao 4.13+
2.0.1
2024-07-12 06:13 UTC
Requires
- php: ^8.1
- contao/core-bundle: ^4.13 || ^5.0
- symfony/config: ^5.4 || ^6.4
- symfony/dependency-injection: ^5.4 || ^6.4
- symfony/http-kernel: ^5.4 || ^6.4
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.5
- contao/manager-plugin: ^2.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
- symfony/phpunit-bridge: ^6.1
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
This package is auto-updated.
Last update: 2024-09-12 06:32:31 UTC
README
这是一个工具,允许您通过别名而非ID引用模块。如果您有一个包含多个阶段、数据库和系统的部署流程,这些系统最终不共享相同的模块ID,那么这一点尤为重要。
tl_module的DCA通过一个名为"alias"的字段进行了扩展。
要求
- Contao 4.13+
- PHP 7.4或8.0+
安装
$ composer require guave/insertmodulebyalias-bundle
用法
要加载一个模块,您可以在模板中使用以下语法
{{insert_module_alias::modulealias}}
如果您需要特定语言的模块,可以在别名中添加语言,如_en
,然后在模板中加载它
{{insert_module_alias::modulealias_en}}
自Contao 4.13起,您还可以创建一个"根页面依赖模块"模块。在那里,您可以选择每个根页面应加载哪个模块。