feat: add content elements, change backend preview

This commit is contained in:
2024-12-15 19:08:26 +01:00
parent 1076fe6447
commit 696881e4f8
15 changed files with 137 additions and 26 deletions

View File

@@ -7,10 +7,11 @@ RTE {
}
TCEFORM {
pages {
}
tt_content {
tt_content {
CType {
keepItems = cloonar_header,cloonar_text,cloonar_textimage,news_newsliststicky,news_pi1,cloonar_hero,cloonar_stats
}
}
}
TCEMAIN {

View File

@@ -0,0 +1 @@
/* CSS for header content element */

View File

@@ -0,0 +1,10 @@
name: cloonar/header
typeName: cloonar_header
group: default
prefixFields: true
prefixType: full
label: LLL:EXT:base/ContentBlocks/ContentElements/header/language/labels.xlf:header.title
description: LLL:EXT:base/ContentBlocks/ContentElements/header/language/labels.xlf:header.description
fields:
- identifier: header
useExistingField: true

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages">
<body>
<trans-unit id="title">
<source>Header</source>
</trans-unit>
<trans-unit id="description">
<source>A simple content element that displays a header as an H1.</source>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -0,0 +1,15 @@
<html
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Preview"/>
<f:section name="Header">
<be:link.editRecord uid="{data.uid}" table="{data.mainType}">
<f:if condition="{data.header}">
<f:then><strong>{data.header}</strong></f:then>
</f:if>
</be:link.editRecord>
</f:section>
<f:section name="Content">
</f:section>
</html>

View File

@@ -0,0 +1,4 @@
<f:layout name="Default" />
<f:section name="Main">
<h1>{data.header}</h1>
</f:section>

View File

@@ -7,7 +7,7 @@
<source>Hero</source>
</trans-unit>
<trans-unit id="description">
<source>Description for Content Element cloonar/hero</source>
<source>Hero Element should always be the first Element of the page</source>
</trans-unit>
</body>
</file>

View File

@@ -2,20 +2,27 @@
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Preview"/>
<f:section name="Header">
<be:link.editRecord uid="{data.uid}" table="{data.mainType}">{data.header}</be:link.editRecord>
<be:link.editRecord uid="{data.uid}" table="{data.mainType}">
<f:if condition="{data.header}">
<f:then><strong>{data.header}</strong></f:then>
</f:if>
</be:link.editRecord>
</f:section>
<f:section name="Content">
Preview for Content Block: cloonar/hero
</f:section>
<f:if condition="{data.image}">
<f:image image="{data.image.0}" width="100" height="auto" treatIdAsReference="1" alt="Preview image" />
</f:if>
<f:comment>
<!-- Uncomment to override preview footer -->
<f:section name="Footer">
My custom Footer
<f:if condition="{data.bodytext}">
<p>
<f:format.crop maxCharacters="80">
<f:format.stripTags>{data.bodytext}</f:format.stripTags>
</f:format.crop>
</p>
</f:if>
</f:section>
</f:comment>
</html>

View File

@@ -5,9 +5,6 @@
<f:layout name="Preview"/>
<f:section name="Header">
<be:link.editRecord uid="{data.uid}" table="{data.mainType}">
Statistics Preview
</be:link.editRecord>
</f:section>
<f:section name="Content">

View File

@@ -0,0 +1 @@
/* CSS for text content element */

View File

@@ -0,0 +1,14 @@
name: cloonar/text
typeName: cloonar_text
group: default
prefixFields: true
prefixType: full
label: LLL:EXT:base/ContentBlocks/ContentElements/text/language/labels.xlf:text.title
description: LLL:EXT:base/ContentBlocks/ContentElements/text/language/labels.xlf:text.description
fields:
- identifier: header
useExistingField: true
- identifier: bodytext
type: Textarea
enableRichtext: true
useExistingField: true

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages">
<body>
<trans-unit id="title">
<source>Text</source>
</trans-unit>
<trans-unit id="description">
<source>A text element featuring a headline (H2) and a rich-text body field.</source>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -0,0 +1,22 @@
<html
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Preview"/>
<f:section name="Header">
<be:link.editRecord uid="{data.uid}" table="{data.mainType}">
<f:if condition="{data.header}">
<f:then><strong>{data.header}</strong></f:then>
</f:if>
</be:link.editRecord>
</f:section>
<f:section name="Content">
<f:if condition="{data.bodytext}">
<p>
<f:format.crop maxCharacters="80">
<f:format.stripTags>{data.bodytext}</f:format.stripTags>
</f:format.crop>
</p>
</f:if>
</f:section>
</html>

View File

@@ -0,0 +1,11 @@
<f:layout name="Default" />
<f:section name="Main">
<f:if condition="{data.header}">
<f:then><h2>{data.header}</h2></f:then>
</f:if>
<f:if condition="{data.bodytext}">
<f:then>
<div class="text-bodytext"><f:format.html>{data.bodytext}</f:format.html></div>
</f:then>
</f:if>
</f:section>

View File

@@ -7,20 +7,22 @@
<f:section name="Header">
<be:link.editRecord uid="{data.uid}" table="{data.mainType}">
<f:if condition="{data.header}">
<f:then>{data.header}</f:then>
<f:else>Text/Image Element</f:else>
<f:then><strong>{data.header}</strong></f:then>
</f:if>
</be:link.editRecord>
</f:section>
<f:section name="Content">
<f:if condition="{data.bodytext}">
<f:then>
<p>Preview: <f:format.crop maxCharacters="50">{data.bodytext}</f:format.crop></p>
</f:then>
<f:else>
<p>No text available</p>
</f:else>
</f:if>
<f:if condition="{data.image}">
<f:image image="{data.image.0}" width="100" height="auto" treatIdAsReference="1" alt="Preview image" />
</f:if>
<f:if condition="{data.bodytext}">
<p>
<f:format.crop maxCharacters="80">
<f:format.stripTags>{data.bodytext}</f:format.stripTags>
</f:format.crop>
</p>
</f:if>
</f:section>
</html>