Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/footer #48

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Classes/Event/Listener/AfterTcaCompilationEventListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Remind\Headless\Event\Listener;

use TYPO3\CMS\Core\Configuration\Event\AfterTcaCompilationEvent;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

class AfterTcaCompilationEventListener
{
public function __invoke(AfterTcaCompilationEvent $event): void
{
/**
* Adding palette here makes sure all content elements,
* even the ones added in extensions after this one, are included
*/
ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'--div--;LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies,--palette--;;cookies',
'',
'after:rowDescription'
);
$event->setTca($GLOBALS['TCA']);
}
}
12 changes: 12 additions & 0 deletions Classes/Utility/TcaUtility.php
Original file line number Diff line number Diff line change
@@ -91,6 +91,18 @@ public static function addPageConfigFlexForm(array|string $dataStructure): void
$GLOBALS['TCA']['pages']['columns']['tx_headless_config']['config']['ds']['default'] = $newFlexFormString;
}

/**
* @param mixed[]|string $dataStructure either a xml flexform file path, a xml flexform string or a flexform array
*/
public static function setFooterFlexForm(array|string $dataStructure): void
{
$newFlexFormArray = self::getFlexFormArray($dataStructure);
$flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
$newFlexFormString = $flexFormTools->flexArray2Xml($newFlexFormArray, true);

$GLOBALS['TCA']['pages']['columns']['tx_headless_footer']['config']['ds']['default'] = $newFlexFormString;
}

/**
* @param mixed[]|string $dataStructure either a xml flexform file path, a xml flexform string or a flexform array
* @return mixed[]
4 changes: 4 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -19,3 +19,7 @@ services:
tags:
-
name: event.listener
Remind\Headless\Event\Listener\AfterTcaCompilationEventListener:
tags:
-
name: event.listener
24 changes: 23 additions & 1 deletion Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
@@ -37,6 +37,19 @@
'displayCond' => 'FIELD:is_siteroot:REQ:true',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_pages.xlf:page_config',
],
'tx_headless_footer' => [
'config' => [
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'ds' => [
'default' => 'FILE:EXT:rmnd_headless/Configuration/FlexForms/Empty.xml',
],
'type' => 'flex',
],
'displayCond' => 'FIELD:is_siteroot:REQ:true',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_pages.xlf:footer',
],
'tx_headless_overview_label' => [
'config' => [
'type' => 'input',
@@ -61,5 +74,14 @@

ExtensionManagementUtility::addToAllTCAtypes(
'pages',
'tx_headless_config',
'--div--;LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_pages.xlf:page_config,tx_headless_config',
'',
'after:rowDescription'
);

ExtensionManagementUtility::addToAllTCAtypes(
'pages',
'--div--;LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_pages.xlf:footer,tx_headless_footer',
'',
'after:rowDescription'
);
29 changes: 18 additions & 11 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -46,31 +46,31 @@
'default' => null,
'items' => [
[
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookie.category.none',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies.category.none',
'value' => null,
],
[
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookie.category.necessary',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies.category.necessary',
'value' => 0,
],
[
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookie.category.preferences',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies.category.preferences',
'value' => 1,
],
[
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookie.category.statistics',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies.category.statistics',
'value' => 2,
],
[
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookie.category.marketing',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies.category.marketing',
'value' => 3,
],
],
'renderType' => 'selectSingle',
'type' => 'select',
],
'exclude' => 0,
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookie.category',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies.category',
],
'tx_headless_cookie_message' => [
'config' => [
@@ -81,7 +81,7 @@
'type' => 'text',
],
'l10n_mode' => 'prefixLangTitle',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookie.message',
'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:cookies.message',
],
'tx_headless_item' => [
'config' => [
@@ -189,8 +189,15 @@
'after:space_after_class'
);

ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'tx_headless_cookie_category');
ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'tx_headless_cookie_message');
/**
* Palette will be added in AfterTcaCompilationEventListener so Content Elements
* added in Extensions after this one will also have the palette
*/
ExtensionManagementUtility::addFieldsToPalette(
'tt_content',
'cookies',
'tx_headless_cookie_category,--linebreak--,tx_headless_cookie_message',
);

$GLOBALS['TCA']['tt_content']['ctrl']['previewRenderer'] = ContentWithItemsPreviewRenderer::class;

@@ -230,5 +237,5 @@
];

// Workaround for TCEFORM (https://forge.typo3.org/issues/100775)
$GLOBALS['TCA']['tt_content']['columns']['space_after_class']['config']['items'][0]['label'] = 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:space_none';
$GLOBALS['TCA']['tt_content']['columns']['space_before_class']['config']['items'][0]['label'] = 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:space_none';
$GLOBALS['TCA']['tt_content']['columns']['space_after_class']['config']['items'][0]['label'] = 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:space_none';
$GLOBALS['TCA']['tt_content']['columns']['space_before_class']['config']['items'][0]['label'] = 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:space_none';
37 changes: 0 additions & 37 deletions Configuration/TCA/Overrides/tt_content_footer_content.php

This file was deleted.

6 changes: 0 additions & 6 deletions Configuration/TSConfig/Page/BackendLayouts/default.tsconfig
Original file line number Diff line number Diff line change
@@ -13,9 +13,6 @@ mod {
1 {
name = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_bl.xlf:column.above_breadcrumbs
colPos = 1687238554
disallowed {
CType = footer_content
}
}
}
}
@@ -24,9 +21,6 @@ mod {
1 {
name = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_bl.xlf:column.main
colPos = 0
disallowed {
CType = footer_content
}
}
}
}
17 changes: 1 addition & 16 deletions Configuration/TSConfig/Page/BackendLayouts/root.tsconfig
Original file line number Diff line number Diff line change
@@ -6,28 +6,13 @@ mod {
config {
backend_layout {
colCount = 1
rowCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_bl.xlf:column.main
colPos = 0
disallowed {
CType = footer_content
}
}
}
}
2 {
columns {
1 {
name = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_bl.xlf:column.footer
colPos = 1687238527
allowed {
CType = footer_content
}
maxitems = 1
}
}
}
3 changes: 0 additions & 3 deletions Configuration/TSConfig/Page/TCEFORM.tsconfig
Original file line number Diff line number Diff line change
@@ -18,9 +18,6 @@ TCEFORM {
altLabels.image = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ce.xlf:image.title
}
frame_class.disabled = 1
header.types {
footer_content.label = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ttc.xlf:header.label.backendOnly
}
image.types {
image.config.maxitems = 1
image.config.minitems = 1
9 changes: 0 additions & 9 deletions Configuration/TSConfig/Page/WizardItems.tsconfig
Original file line number Diff line number Diff line change
@@ -9,14 +9,6 @@ mod.wizards.newContentElement.wizardItems {
CType = accordion
}
}
footer_content {
iconIdentifier = content-footer
title = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ce.xlf:footer_content.title
description = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ce.xlf:footer_content.description
tt_content_defValues {
CType = footer_content
}
},
// Element already exsists, only modify title and description
image {
title = LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_ce.xlf:image.title
@@ -40,7 +32,6 @@ mod.wizards.newContentElement.wizardItems {
}
}
show := addToList(accordion)
show := addToList(footer_content)
show := addToList(image_gallery)
show := addToList(tabs)
}
Original file line number Diff line number Diff line change
@@ -16,15 +16,15 @@ initialData {
}
}
}
footer = CONTENT
footer = JSON
footer {
table = tt_content
select {
orderBy = sorting
where = {#colPos} = 1687238527
max = 1
dataProcessing {
10 = Remind\Headless\DataProcessing\FlexFormProcessor
10 {
fieldName = tx_headless_footer
as = flexform
}
}
slide = -1
}
}
}
10 changes: 0 additions & 10 deletions Configuration/TypoScript/ContentElement/FooterContent.typoscript

This file was deleted.

26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -29,11 +29,7 @@ Required dependencies are [headless](https://github.com/TYPO3-Headless/headless)

### Default

The default layout consists of 1 column with 3 rows. Besides the main content (colPos = 0) there is also one column for content above the breadcrumbs (colPos = 1) and the footer (colPos = 10).

The [content defender](https://extensions.typo3.org/extension/content_defender) extension is used to only allow exactly one footer_content content element in the footer column. The footer_content content element can not be used in the other columns.


The default layout consists of 1 column with 2 rows. Besides the main content (colPos = 0) there is also one column for content above the breadcrumbs (colPos = 1).

## TCA

@@ -126,6 +122,14 @@ Similar to `space_before_inside`.

### pages

#### tx_headless_footer

The `tx_headless_footer` flexform field contains the footer content. Use the following code to set a flexform:

```php
\Remind\Headless\Utility::setFooterFlexForm('FILE:EXT:provider_extension/Configuration/FlexForms/Footer.xml');
```

#### tx_headless_overview_label

An `tx_headless_overview_label` field is added to the page TCA. The field should be used to customize the label for the overview pages.
@@ -177,18 +181,6 @@ $GLOBALS['TCA']['tt_content']['types']['accordion']['columnsOverrides']['tx_head

Uses `tx_headless_item`, items consist of text (header, subheader, bodytext, title), a flexform field and images.

### footer_content

Basic definition without any actual content fields. Add a flexform in your provider extension to use `footer_content`:

```php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
'*',
'FILE:EXT:provider_extension/Configuration/FlexForms/FooterContent.xml',
'footer_content'
);
```

### tabs

Uses `tx_headless_item`, items consist of text (header, subheader, bodytext) only.
3 changes: 0 additions & 3 deletions Resources/Private/Language/de.locallang_bl.xlf
Original file line number Diff line number Diff line change
@@ -9,9 +9,6 @@
<trans-unit id="column.above_breadcrumbs">
<target>Über Breadcrumbs</target>
</trans-unit>
<trans-unit id="column.footer">
<target>Fußzeile</target>
</trans-unit>
<trans-unit id="default">
<target>Standard</target>
</trans-unit>
6 changes: 0 additions & 6 deletions Resources/Private/Language/de.locallang_ce.xlf
Original file line number Diff line number Diff line change
@@ -12,12 +12,6 @@
<trans-unit id="accordion.columns.title">
<target>Akkordion Titel</target>
</trans-unit>
<trans-unit id="footer_content.description">
<target>Content Element zur Benutzung in Fußzeile</target>
</trans-unit>
<trans-unit id="footer_content.title">
<target>Fußzeile Inhalt</target>
</trans-unit>
<trans-unit id="image.description">
<target>Einzelnes Bild</target>
</trans-unit>
3 changes: 3 additions & 0 deletions Resources/Private/Language/de.locallang_pages.xlf
Original file line number Diff line number Diff line change
@@ -9,6 +9,9 @@
<trans-unit id="breadcrumbs_background_color.none">
<target>Keine</target>
</trans-unit>
<trans-unit id="footer">
<target>Footer</target>
</trans-unit>
<trans-unit id="page_config">
<target>Page Config</target>
</trans-unit>
17 changes: 10 additions & 7 deletions Resources/Private/Language/de.locallang_ttc.xlf
Original file line number Diff line number Diff line change
@@ -12,25 +12,28 @@
<trans-unit id="background_full_width">
<target>Hintergrund über gesamte Breite</target>
</trans-unit>
<trans-unit id="cookie.category">
<trans-unit id="cookies">
<target>Cookies</target>
</trans-unit>
<trans-unit id="cookies.category">
<target>Cookie Kategorie</target>
</trans-unit>
<trans-unit id="cookie.category.none">
<trans-unit id="cookies.category.none">
<target>Keine</target>
</trans-unit>
<trans-unit id="cookie.category.necessary">
<trans-unit id="cookies.category.necessary">
<target>Notwendig</target>
</trans-unit>
<trans-unit id="cookie.category.preferences">
<trans-unit id="cookies.category.preferences">
<target>Präferenzen</target>
</trans-unit>
<trans-unit id="cookie.category.statistics">
<trans-unit id="cookies.category.statistics">
<target>Statistiken</target>
</trans-unit>
<trans-unit id="cookie.category.marketing">
<trans-unit id="cookies.category.marketing">
<target>Marketing</target>
</trans-unit>
<trans-unit id="cookie.message">
<trans-unit id="cookies.message">
<target>Cookie Meldung</target>
</trans-unit>
<trans-unit id="header.label.backendOnly">
3 changes: 0 additions & 3 deletions Resources/Private/Language/locallang_bl.xlf
Original file line number Diff line number Diff line change
@@ -9,9 +9,6 @@
<trans-unit id="column.above_breadcrumbs">
<source>Above Breadcrumbs</source>
</trans-unit>
<trans-unit id="column.footer">
<source>Footer</source>
</trans-unit>
<trans-unit id="default">
<source>Default</source>
</trans-unit>
6 changes: 0 additions & 6 deletions Resources/Private/Language/locallang_ce.xlf
Original file line number Diff line number Diff line change
@@ -12,12 +12,6 @@
<trans-unit id="accordion.columns.title">
<source>Accordion Title</source>
</trans-unit>
<trans-unit id="footer_content.description">
<source>Content Element to be used in Footer</source>
</trans-unit>
<trans-unit id="footer_content.title">
<source>Footer Content</source>
</trans-unit>
<trans-unit id="image.description">
<source>One Image only</source>
</trans-unit>
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang_pages.xlf
Original file line number Diff line number Diff line change
@@ -9,6 +9,9 @@
<trans-unit id="breadcrumbs_background_color.none">
<source>None</source>
</trans-unit>
<trans-unit id="footer">
<source>Footer</source>
</trans-unit>
<trans-unit id="page_config">
<source>Page Config</source>
</trans-unit>
17 changes: 10 additions & 7 deletions Resources/Private/Language/locallang_ttc.xlf
Original file line number Diff line number Diff line change
@@ -12,25 +12,28 @@
<trans-unit id="background_full_width">
<source>Full Width Background</source>
</trans-unit>
<trans-unit id="cookie.category">
<trans-unit id="cookies">
<source>Cookies</source>
</trans-unit>
<trans-unit id="cookies.category">
<source>Cookie Category</source>
</trans-unit>
<trans-unit id="cookie.category.none">
<trans-unit id="cookies.category.none">
<source>None</source>
</trans-unit>
<trans-unit id="cookie.category.necessary">
<trans-unit id="cookies.category.necessary">
<source>Necessary</source>
</trans-unit>
<trans-unit id="cookie.category.preferences">
<trans-unit id="cookies.category.preferences">
<source>Preferences</source>
</trans-unit>
<trans-unit id="cookie.category.statistics">
<trans-unit id="cookies.category.statistics">
<source>Statistics</source>
</trans-unit>
<trans-unit id="cookie.category.marketing">
<trans-unit id="cookies.category.marketing">
<source>Marketing</source>
</trans-unit>
<trans-unit id="cookie.message">
<trans-unit id="cookies.message">
<source>Cookie Message</source>
</trans-unit>
<trans-unit id="header.label.backendOnly">
44 changes: 0 additions & 44 deletions Resources/Public/Icons/content-footer.svg

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@
}
},
"require": {
"ichhabrecht/content-defender":"^3.4",
"php": "^8.2",
"typo3/cms-core": "^12.4",
"friendsoftypo3/headless": "^4.4"
237 changes: 80 additions & 157 deletions composer.lock
13 changes: 0 additions & 13 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -2,22 +2,9 @@

declare(strict_types=1);

use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Utility\GeneralUtility;

defined('TYPO3') or die;

(function (): void {
/* @var $iconRegistry \TYPO3\CMS\Core\Imaging\IconRegistry */
$iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);

$iconRegistry->registerIcon(
'content-footer',
SvgIconProvider::class,
['source' => 'EXT:rmnd_headless/Resources/Public/Icons/content-footer.svg']
);

$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['headless.elementBodyResponse'] = true;

$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['headless.frontendUrls'] = true;
1 change: 1 addition & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ CREATE TABLE tt_content (
CREATE TABLE pages (
tx_headless_breadcrumbs_background_color VARCHAR(60),
tx_headless_config mediumtext,
tx_headless_footer mediumtext,
tx_headless_overview_label VARCHAR(60) DEFAULT '' NOT NULL,
);