punktde / typo3-yaml-loader
从 YAML 文件加载内容类型和 doktypes
1.0.2
2023-10-02 12:16 UTC
Requires
- symfony/validator: ^6.3
- typo3/cms-core: ^12.4
Requires (Dev)
- phpunit/phpunit: ^10
- typo3/testing-framework: ^8.0
README
此软件包是为了通过 YAML 文件配置内容类型和 doktype,而不是通过 TYPO3 核心的复杂过程来创建的。
设置
安装
安装此软件包
composer req punktde/typo3-yaml-loader
包含配置
将以下行添加到您的 ext_tables.php
$doktypeLoader = GeneralUtility::makeInstance(DoktypeLoader::class, 'your-site-extension-key');
$doktypeLoader->loadPageTypes();
将以下行添加到您的 ext_localconf.php
$doktypeLoader = GeneralUtility::makeInstance(DoktypeLoader::class, 'your-site-extension-key');
$doktypeLoader->loadPageTS();
/** @var ContentTypeLoader $contentTypeLoader */
$contentTypeLoader = GeneralUtility::makeInstance(ContentTypeLoader::class, 'your-site-extension-key');
$contentTypeLoader->loadPageTS();
将以下行添加到您的 Configuration/TCA/Overrides/pages.php
$doktypeLoader = GeneralUtility::makeInstance(DoktypeLoader::class, 'your-site-extension-key');
$doktypeLoader->loadTcaOverrides();
将以下行添加到您的 Configuration/TCA/Overrides/tt_content.php
$contentTypeLoader = GeneralUtility::makeInstance(ContentTypeLoader::class, 'your-site-extension-key');
$contentTypeLoader->loadTcaOverrides();
请注意:此软件包不包含任何用于渲染自定义内容类型或 doktype 的配置。您需要自行处理通过 Typoscript 进行渲染的注册。
对于 doktypes,您需要配置您的
page
对象以选择正确的模板,例如基于 backend_layout。TYPO3 将后端布局命名为
pagets__{YOUR_IDENTIFIER}
。您可以使用此标识符来渲染适当的模板。
添加内容或页面类型
创建 YAML 配置
YAML 配置文件位于 Configuration/(ContentTypes|Doktyps)/(Elements|Palettes)
加载时将验证 yaml 配置,验证规则可在以下类中找到
Classes/Validator/*Validator.php
鸣谢
ArrayToTyposcriptConverter
类深受 Armin Vieweg 的此 gist 启发。