punktde / typo3-yaml-loader
Load content types and doktypes from yaml
Installs: 40
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 6
Forks: 1
Open Issues: 0
Type:typo3-cms-extension
Requires
- symfony/validator: ^6.3
- typo3/cms-core: ^12.4
Requires (Dev)
- phpunit/phpunit: ^10
- typo3/testing-framework: ^8.0
README
This package was created as a proof-of-concept for content-type and doktype configuration via YAML files instead of the complicated process currently required by the TYPO3 Core
Setup
Install
Install this package
composer req punktde/typo3-yaml-loader
Include configuration
Add the following lines to your ext_tables.php
:
$doktypeLoader = GeneralUtility::makeInstance(DoktypeLoader::class, 'your-site-extension-key');
$doktypeLoader->loadPageTypes();
Add the following lines to your 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();
Add the following lines to your Configuration/TCA/Overrides/pages.php
:
$doktypeLoader = GeneralUtility::makeInstance(DoktypeLoader::class, 'your-site-extension-key');
$doktypeLoader->loadTcaOverrides();
Add the following lines to your Configuration/TCA/Overrides/tt_content.php
:
$contentTypeLoader = GeneralUtility::makeInstance(ContentTypeLoader::class, 'your-site-extension-key');
$contentTypeLoader->loadTcaOverrides();
Please Note: This package does not contain any configuration for rendering of custom Content-Types or Doktypes. You will need to take care of registering rendering via Typoscript yourself.
For Content Elements see https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html#configure-the-frontend-rendering
For doktypes you will need to configure your
page
object to choose the correct template, eg. based on backend_layout.Backend Layouts will be named as
pagets__{YOUR_IDENTIFIER}
by TYPO3. You can use this identifier to render the appropriate template.
Add a Content or Page Type
Create YAML Config
YAML configuration files are located at Configuration/(ContentTypes|Doktyps)/(Elements|Palettes)
The yaml config will be validated on load, you can find the validation-rules in the following class:
Classes/Validator/*Validator.php
Acknowledgments
The ArrayToTyposcriptConverter
class is heavily inspired by this gist by Armin Vieweg: