From ce569b616f2e47eccf47b8dd0d8f0938a6a5f5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Uzna=C5=84ski?= Date: Mon, 2 Oct 2023 13:42:59 +0200 Subject: [PATCH 1/2] [BUGFIX] Fixes for php-cs-fixer, also fix files (#656) Also switch to main branch to avoid deprecations --- .../Listener/AfterCacheableContentIsGeneratedListener.php | 4 +--- Classes/Event/Listener/AfterLinkIsGeneratedListener.php | 3 +-- .../Event/Listener/AfterPagePreviewUriGeneratedListener.php | 4 +--- Classes/Form/Decorator/FormDefinitionDecorator.php | 4 +--- Classes/ViewHelpers/DomainViewHelper.php | 2 +- Tests/Unit/ContentObject/DataProcessingExample.php | 2 +- Tests/Unit/ContentObject/EmptyDataProcessingExample.php | 2 +- .../DataProcessing/RootSiteProcessing/TestSiteProvider.php | 4 +--- composer.json | 2 +- 9 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Classes/Event/Listener/AfterCacheableContentIsGeneratedListener.php b/Classes/Event/Listener/AfterCacheableContentIsGeneratedListener.php index ec4aefd3..7150ec62 100644 --- a/Classes/Event/Listener/AfterCacheableContentIsGeneratedListener.php +++ b/Classes/Event/Listener/AfterCacheableContentIsGeneratedListener.php @@ -20,9 +20,7 @@ class AfterCacheableContentIsGeneratedListener { - public function __construct(private readonly JsonEncoder $encoder) - { - } + public function __construct(private readonly JsonEncoder $encoder) {} public function __invoke(AfterCacheableContentIsGeneratedEvent $event) { diff --git a/Classes/Event/Listener/AfterLinkIsGeneratedListener.php b/Classes/Event/Listener/AfterLinkIsGeneratedListener.php index 3fcb887b..4e1a8150 100644 --- a/Classes/Event/Listener/AfterLinkIsGeneratedListener.php +++ b/Classes/Event/Listener/AfterLinkIsGeneratedListener.php @@ -21,8 +21,7 @@ final class AfterLinkIsGeneratedListener public function __construct( private readonly HeadlessFrontendUrlInterface $urlUtility, private readonly LinkService $linkService - ) { - } + ) {} public function __invoke(AfterLinkIsGeneratedEvent $event): void { diff --git a/Classes/Event/Listener/AfterPagePreviewUriGeneratedListener.php b/Classes/Event/Listener/AfterPagePreviewUriGeneratedListener.php index 6a3b9d6e..0a59044a 100644 --- a/Classes/Event/Listener/AfterPagePreviewUriGeneratedListener.php +++ b/Classes/Event/Listener/AfterPagePreviewUriGeneratedListener.php @@ -17,9 +17,7 @@ final class AfterPagePreviewUriGeneratedListener { - public function __construct(private readonly HeadlessFrontendUrlInterface $urlUtility) - { - } + public function __construct(private readonly HeadlessFrontendUrlInterface $urlUtility) {} public function __invoke(AfterPagePreviewUriGeneratedEvent $event): void { diff --git a/Classes/Form/Decorator/FormDefinitionDecorator.php b/Classes/Form/Decorator/FormDefinitionDecorator.php index ff4f3b62..068f9e44 100644 --- a/Classes/Form/Decorator/FormDefinitionDecorator.php +++ b/Classes/Form/Decorator/FormDefinitionDecorator.php @@ -11,6 +11,4 @@ namespace FriendsOfTYPO3\Headless\Form\Decorator; -class FormDefinitionDecorator extends AbstractFormDefinitionDecorator -{ -} +class FormDefinitionDecorator extends AbstractFormDefinitionDecorator {} diff --git a/Classes/ViewHelpers/DomainViewHelper.php b/Classes/ViewHelpers/DomainViewHelper.php index 58156de6..fa66be2f 100644 --- a/Classes/ViewHelpers/DomainViewHelper.php +++ b/Classes/ViewHelpers/DomainViewHelper.php @@ -38,7 +38,7 @@ public static function renderStatic( case 'frontendBase': return $urlUtility->getFrontendUrl(); case 'proxyUrl': - return $urlUtility->getProxyUrl(); + return $urlUtility->getProxyUrl(); case 'storageProxyUrl': return $urlUtility->getStorageProxyUrl(); } diff --git a/Tests/Unit/ContentObject/DataProcessingExample.php b/Tests/Unit/ContentObject/DataProcessingExample.php index 269bb055..8f190c7a 100644 --- a/Tests/Unit/ContentObject/DataProcessingExample.php +++ b/Tests/Unit/ContentObject/DataProcessingExample.php @@ -34,6 +34,6 @@ public function process( $processedData[$targetVariableName] = ['SomeCustomProcessing']; - return $processedData; + return $processedData; } } diff --git a/Tests/Unit/ContentObject/EmptyDataProcessingExample.php b/Tests/Unit/ContentObject/EmptyDataProcessingExample.php index af99f6a1..f163a1d3 100644 --- a/Tests/Unit/ContentObject/EmptyDataProcessingExample.php +++ b/Tests/Unit/ContentObject/EmptyDataProcessingExample.php @@ -33,6 +33,6 @@ public function process( $processedData[$targetVariableName] = [null]; - return $processedData; + return $processedData; } } diff --git a/Tests/Unit/DataProcessing/RootSiteProcessing/TestSiteProvider.php b/Tests/Unit/DataProcessing/RootSiteProcessing/TestSiteProvider.php index bc86ea3d..9b1b67a5 100644 --- a/Tests/Unit/DataProcessing/RootSiteProcessing/TestSiteProvider.php +++ b/Tests/Unit/DataProcessing/RootSiteProcessing/TestSiteProvider.php @@ -16,9 +16,7 @@ class TestSiteProvider implements SiteProviderInterface { - public function prepare(array $config, int $siteUid) - { - } + public function prepare(array $config, int $siteUid) {} public function getSites(): array { diff --git a/composer.json b/composer.json index 20b05ae0..83df2a32 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "ext-json": "*", "typo3/cms-core": "^12.4", "typo3/cms-install": "^12.4", - "typo3/coding-standards": "^0.7.1" + "typo3/coding-standards": "dev-main" }, "require-dev": { "ergebnis/composer-normalize": "^2.15.0", From 7d5a90e88fa057b0ae1ce45fb4a952638c971f33 Mon Sep 17 00:00:00 2001 From: twoldanski <66474451+twoldanski@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:46:15 +0200 Subject: [PATCH 2/2] [TASK] Typoscript improvements (#643) - Align latest parseFunc with TYPO3 core changes - change default parsing of rte with correct parseFunc - add helper for handling inline helpers --- .../DataProcessing/DatabaseQueryProcessor.php | 2 +- .../ContentElement/Shortcut.typoscript | 23 +------ .../TypoScript/ContentElement/Text.typoscript | 2 +- .../ContentElement/Textmedia.typoscript | 2 +- .../ContentElement/Textpic.typoscript | 2 +- .../ParseFunc.typoscript | 66 ++++++++++++------- .../Helpers/RenderChildren.typoscript | 44 +++++++++++++ Configuration/TypoScript/setup.typoscript | 2 + Documentation/Developer/Index.rst | 2 +- 9 files changed, 95 insertions(+), 50 deletions(-) rename Configuration/TypoScript/{ContentElement => Helpers}/ParseFunc.typoscript (73%) create mode 100644 Configuration/TypoScript/Helpers/RenderChildren.typoscript diff --git a/Classes/DataProcessing/DatabaseQueryProcessor.php b/Classes/DataProcessing/DatabaseQueryProcessor.php index 6ef97268..7bc1cd64 100644 --- a/Classes/DataProcessing/DatabaseQueryProcessor.php +++ b/Classes/DataProcessing/DatabaseQueryProcessor.php @@ -37,7 +37,7 @@ * bodytext = TEXT * bodytext { * field = bodytext - * parseFunc =< lib.parseFunc_links + * parseFunc =< lib.parseFunc_RTE * } * link = TEXT * link { diff --git a/Configuration/TypoScript/ContentElement/Shortcut.typoscript b/Configuration/TypoScript/ContentElement/Shortcut.typoscript index f7ac85bf..eef56788 100755 --- a/Configuration/TypoScript/ContentElement/Shortcut.typoscript +++ b/Configuration/TypoScript/ContentElement/Shortcut.typoscript @@ -3,7 +3,7 @@ tt_content.shortcut { fields { content { fields { - shortcut = COA + shortcut =< lib.renderChildren shortcut { 10 = RECORDS 10 { @@ -13,27 +13,6 @@ tt_content.shortcut { tt_content.stdWrap.wrap = |###BREAK### } } - stdWrap { - innerWrap = [|] - split { - token = ###BREAK### - cObjNum = 1 |*|2|*| 3 - 1 { - current = 1 - stdWrap.wrap = | - } - - 2 { - current = 1 - stdWrap.wrap = ,| - } - - 3 { - current = 1 - stdWrap.wrap = | - } - } - } } } } diff --git a/Configuration/TypoScript/ContentElement/Text.typoscript b/Configuration/TypoScript/ContentElement/Text.typoscript index 1f64fb10..2e2dd796 100755 --- a/Configuration/TypoScript/ContentElement/Text.typoscript +++ b/Configuration/TypoScript/ContentElement/Text.typoscript @@ -6,7 +6,7 @@ tt_content.text { bodytext = TEXT bodytext { field = bodytext - parseFunc =< lib.parseFunc_links + parseFunc =< lib.parseFunc_RTE } } } diff --git a/Configuration/TypoScript/ContentElement/Textmedia.typoscript b/Configuration/TypoScript/ContentElement/Textmedia.typoscript index e6b503bc..679cfd29 100755 --- a/Configuration/TypoScript/ContentElement/Textmedia.typoscript +++ b/Configuration/TypoScript/ContentElement/Textmedia.typoscript @@ -10,7 +10,7 @@ tt_content.textmedia { bodytext = TEXT bodytext { field = bodytext - parseFunc =< lib.parseFunc_links + parseFunc =< lib.parseFunc_RTE } gallery = TEXT gallery { diff --git a/Configuration/TypoScript/ContentElement/Textpic.typoscript b/Configuration/TypoScript/ContentElement/Textpic.typoscript index c74828b4..416fd1db 100755 --- a/Configuration/TypoScript/ContentElement/Textpic.typoscript +++ b/Configuration/TypoScript/ContentElement/Textpic.typoscript @@ -10,7 +10,7 @@ tt_content.textpic { bodytext = TEXT bodytext { field = bodytext - parseFunc =< lib.parseFunc_links + parseFunc =< lib.parseFunc_RTE } gallery = TEXT gallery { diff --git a/Configuration/TypoScript/ContentElement/ParseFunc.typoscript b/Configuration/TypoScript/Helpers/ParseFunc.typoscript similarity index 73% rename from Configuration/TypoScript/ContentElement/ParseFunc.typoscript rename to Configuration/TypoScript/Helpers/ParseFunc.typoscript index 903b0758..a000bad2 100755 --- a/Configuration/TypoScript/ContentElement/ParseFunc.typoscript +++ b/Configuration/TypoScript/Helpers/ParseFunc.typoscript @@ -6,22 +6,15 @@ lib { makelinks { http { keep = {$styles.content.links.keep} - extTarget.data = parameters:target + extTarget = {$styles.content.links.extTarget} } + mailto { keep = path } } + tags { - link = TEXT - link { - current = 1 - typolink { - parameter.data = parameters : allParams - extTarget.data = parameters:target - } - parseFunc.constants = 1 - } a = TEXT a { current = 1 @@ -29,14 +22,24 @@ lib { parameter.data = parameters:href title.data = parameters:title ATagParams.data = parameters:allParams - target.data = parameters:target - extTarget.data = parameters:target + # the target attribute takes precedence over config.intTarget + target.ifEmpty.data = parameters:target + # the target attribute takes precedence over the constant (styles.content.links.extTarget) + # which takes precedence over config.extTarget + # do not pass extTarget as reference, as it might not be set resulting in the string being + # written to the target attribute + extTarget { + ifEmpty < config.extTarget + ifEmpty.override = {$styles.content.links.extTarget} + override.data = parameters:target + } } } } + allowTags = {$styles.content.allowTags} denyTags = * - sword = | + # @deprecated since TYPO3 v12, remove with v13 constants = 1 nonTypoTagStdWrap { HTMLparser = 1 @@ -51,19 +54,22 @@ lib { parseFunc_RTE < lib.parseFunc parseFunc_RTE { # Processing
    ,