Add custom content element
This includes: - Wizard - TCA - Backend Preview - Frontend Rendering: - TypoScript - Fluid
This commit is contained in:
parent
b0a6d51b2c
commit
fde6099602
11 changed files with 173 additions and 2 deletions
|
@ -47,5 +47,4 @@ Resources
|
|||
|
||||
- https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Index.html
|
||||
|
||||
|
||||
|
||||
- https://docs.typo3.org/c/typo3/cms-fluid-styled-content/main/en-us/
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:sitepackage/Configuration/PageTSconfig/Mod/" extensions="tsconfig">
|
|
@ -0,0 +1,35 @@
|
|||
// See: https://docs.typo3.org/m/typo3/reference-tsconfig/main/en-us/PageTsconfig/Mod.html
|
||||
|
||||
mod {
|
||||
wizards.newContentElement.wizardItems.special {
|
||||
elements {
|
||||
admonition {
|
||||
iconIdentifier = content-idea
|
||||
title = Admonition
|
||||
description = Displays a hint, note, …
|
||||
tt_content_defValues {
|
||||
CType = admonition
|
||||
header_layout = note
|
||||
}
|
||||
}
|
||||
}
|
||||
show := addToList(admonition)
|
||||
}
|
||||
web_layout.tt_content.preview.admonition = EXT:sitepackage/Resources/Private/Templates/Backend/ContentElements/Admonition.html
|
||||
}
|
||||
|
||||
// See: https://docs.typo3.org/m/typo3/reference-tsconfig/main/en-us/PageTsconfig/TceForm.html
|
||||
|
||||
TCEFORM.tt_content {
|
||||
CType.addItems := addToList(admonition)
|
||||
header_layout.types.admonition {
|
||||
keepItems =
|
||||
addItems {
|
||||
note = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:frontend.content.admonition.header.note
|
||||
hint = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:frontend.content.admonition.header.hint
|
||||
caution = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:frontend.content.admonition.header.caution
|
||||
danger = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:frontend.content.admonition.header.danger
|
||||
task = LLL:EXT:sitepackage/Resources/Private/Language/locallang.xlf:frontend.content.admonition.header.task
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// See: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Configuration/Tsconfig.html
|
||||
|
||||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
|
||||
'sitepackage',
|
||||
'Configuration/PageTSconfig/Index.tsconfig',
|
||||
'Sitepackage'
|
||||
);
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
// See: https://docs.typo3.org/m/typo3/reference-tca/main/en-us/
|
||||
|
||||
(static function (string $extensionKey, string $tableName, string $contentType) {
|
||||
$languagePath = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_tca.xlf:' . $tableName . '.';
|
||||
|
||||
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA'][$tableName], [
|
||||
'ctrl' => [
|
||||
'typeicon_classes' => [
|
||||
$contentType => 'content-idea',
|
||||
],
|
||||
],
|
||||
'types' => [
|
||||
$contentType => [
|
||||
'showitem' => implode(',', [
|
||||
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general',
|
||||
'--palette--;;general',
|
||||
'header_layout',
|
||||
'bodytext',
|
||||
'--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance',
|
||||
'--palette--;;frames',
|
||||
'--palette--;;appearanceLinks',
|
||||
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language',
|
||||
'--palette--;;language',
|
||||
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access',
|
||||
'--palette--;;hidden',
|
||||
'--palette--;;access',
|
||||
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories',
|
||||
'categories',
|
||||
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes',
|
||||
'rowDescription',
|
||||
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended',
|
||||
]),
|
||||
'columnsOverrides' => [
|
||||
'bodytext' => [
|
||||
'config' => [
|
||||
'enableRichtext' => true,
|
||||
'richtextConfiguration' => 'default',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
|
||||
$tableName,
|
||||
'CType',
|
||||
[
|
||||
$languagePath . $contentType,
|
||||
$contentType,
|
||||
'content-idea',
|
||||
'default'
|
||||
],
|
||||
'image',
|
||||
'after'
|
||||
);
|
||||
})('sitepackage', 'tt_content', 'admonition');
|
|
@ -0,0 +1,4 @@
|
|||
tt_content.admonition =< lib.contentElement
|
||||
tt_content.admonition {
|
||||
templateName = Admonition
|
||||
}
|
|
@ -1 +1,5 @@
|
|||
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:fluid_styled_content/Configuration/TypoScript/constants.typoscript">
|
||||
|
||||
styles.templates {
|
||||
templateRootPath = EXT:sitepackage/Resources/Private/Templates/Frontend/ContentElements/
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="messages" date="2023-02-15T09:24:15Z" product-name="sitepackage">
|
||||
<header/>
|
||||
<body>
|
||||
<trans-unit id="frontend.content.admonition.header.note">
|
||||
<source>Note</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="frontend.content.admonition.header.hint">
|
||||
<source>Hint</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="frontend.content.admonition.header.caution">
|
||||
<source>Caution</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="frontend.content.admonition.header.danger">
|
||||
<source>Danger</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="frontend.content.admonition.header.task">
|
||||
<source>Task</source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="messages" date="2023-02-15T09:23:06Z" product-name="sitepackage">
|
||||
<header/>
|
||||
<body>
|
||||
<trans-unit id="tt_content.admonition">
|
||||
<source>Admonition</source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -0,0 +1,8 @@
|
|||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
<be:link.editRecord uid="{uid}" table="tt_content">
|
||||
<strong style="text-transform: uppercase; letter-spacing: 1em;">{header_layout}</strong>
|
||||
<p>{bodytext -> f:format.stripTags()}</p>
|
||||
</be:link.editRecord>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<html xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
|
||||
{f:layout(name: 'Default')}
|
||||
|
||||
<f:section name="Header">
|
||||
<aside class="admonition-{data.header_layout}">
|
||||
{f:render(partial: 'Header/Header', arguments: {
|
||||
layout: '2',
|
||||
header: "{f:translate(id: 'frontend.content.admonition.header.{data.header_layout}', extensionName: 'Sitepackage')}"
|
||||
})}
|
||||
</f:section>
|
||||
|
||||
<f:section name="Main">
|
||||
{data.bodytext -> f:format.html()}
|
||||
</aside>
|
||||
</f:section>
|
||||
</html>
|
Loading…
Reference in a new issue