punktde/typo3-yaml-loader

从 YAML 文件加载内容类型和 doktypes

安装: 40

依赖者: 0

建议者: 0

安全性: 0

星标: 1

关注者: 6

分支: 1

开放问题: 0

类型:typo3-cms-extension

1.0.2 2023-10-02 12:16 UTC

This package is auto-updated.

Last update: 2024-08-31 00:38:55 UTC


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 进行渲染的注册。

有关内容元素,请参阅https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html#configure-the-frontend-rendering

对于 doktypes,您需要配置您的 page 对象以选择正确的模板,例如基于 backend_layout。

TYPO3 将后端布局命名为 pagets__{YOUR_IDENTIFIER}。您可以使用此标识符来渲染适当的模板。

添加内容或页面类型

创建 YAML 配置

YAML 配置文件位于 Configuration/(ContentTypes|Doktyps)/(Elements|Palettes)

加载时将验证 yaml 配置,验证规则可在以下类中找到

  Classes/Validator/*Validator.php

鸣谢

ArrayToTyposcriptConverter 类深受 Armin Vieweg 的此 gist 启发。

https://gist.github.com/a-r-m-i-n/442693801bab280e42b7