From 204f643b0ddf68144c7e3236fb4f5d3bd609ca6e Mon Sep 17 00:00:00 2001 From: Jochen Date: Mon, 12 Feb 2024 22:42:43 +0100 Subject: [PATCH 1/3] [TASK] Add v12 compatability --- Classes/LinkHandler/PageLinkHandler.php | 12 ++-- Configuration/page.tsconfig | 3 + .../Templates/LinkBrowser/Page.html | 0 .../Private/Templates/LinkBrowser10/Page.html | 67 ------------------- composer.json | 2 +- ext_emconf.php | 29 ++++---- ext_localconf.php | 2 +- 7 files changed, 25 insertions(+), 90 deletions(-) create mode 100644 Configuration/page.tsconfig rename Resources/Private/{ => TemplateOverrides}/Templates/LinkBrowser/Page.html (100%) delete mode 100644 Resources/Private/Templates/LinkBrowser10/Page.html diff --git a/Classes/LinkHandler/PageLinkHandler.php b/Classes/LinkHandler/PageLinkHandler.php index 9b390a0..24cd357 100644 --- a/Classes/LinkHandler/PageLinkHandler.php +++ b/Classes/LinkHandler/PageLinkHandler.php @@ -35,13 +35,13 @@ class PageLinkHandler extends \TYPO3\CMS\Recordlist\LinkHandler\PageLinkHandler implements LinkHandlerInterface, LinkParameterProviderInterface { - public function render(ServerRequestInterface $request) + public function render(ServerRequestInterface $request): string { - if ((new Typo3Version())->getMajorVersion() < 11) { - $this->view->setTemplateRootPaths([200 => 'EXT:link2language/Resources/Private/Templates/LinkBrowser10']); - } else { - $this->view->setTemplateRootPaths([200 => 'EXT:link2language/Resources/Private/Templates/LinkBrowser']); + if ((new Typo3Version())->getMajorVersion() < 12) { + $this->view->setTemplateRootPaths([200 => 'EXT:link2language/Resources/Private/TemplateOverrides/Templates/LinkBrowser']); } + + // page.tsconfig is used to set the template for v12 and above return parent::render($request); } @@ -156,7 +156,7 @@ protected function getRecordsOnExpandedPage($pageId) $colPosMapping = []; foreach ($colPosArray as $colPos) { - $colPosMapping[(int)$colPos[1]] = $colPos[0]; + $colPosMapping[(int)($colPos[1] ?? $colPos["value"])] = $colPos[0] ?? $colPos['label']; } // Enrich list of records $groupedContentElements = []; diff --git a/Configuration/page.tsconfig b/Configuration/page.tsconfig new file mode 100644 index 0000000..dd09ae6 --- /dev/null +++ b/Configuration/page.tsconfig @@ -0,0 +1,3 @@ +templates.typo3/cms-backend { + 1643293191 = b13/link2language:Resources/Private/TemplateOverrides +} diff --git a/Resources/Private/Templates/LinkBrowser/Page.html b/Resources/Private/TemplateOverrides/Templates/LinkBrowser/Page.html similarity index 100% rename from Resources/Private/Templates/LinkBrowser/Page.html rename to Resources/Private/TemplateOverrides/Templates/LinkBrowser/Page.html diff --git a/Resources/Private/Templates/LinkBrowser10/Page.html b/Resources/Private/Templates/LinkBrowser10/Page.html deleted file mode 100644 index 52bd5ef..0000000 --- a/Resources/Private/Templates/LinkBrowser10/Page.html +++ /dev/null @@ -1,67 +0,0 @@ -
-
-
- -

- - - -

-
- {tree -> f:format.raw()} -
-
-
-
- - - -

Link to page

- - - - {language.flag} Link to {language.title} - - - -
- -
{activePageIcon -> f:format.raw()} {activePageTitle -> f:format.raw()}
-
-
- -

- -
    -
  • - -

    - - {groupedByLanguage.flag -> f:format.raw()} - {groupedByLanguage.label} - -

    - -
    Column: {f:if(condition: groupedContentByColPos.label, then: groupedContentByColPos.label, else: 'Unknown')}
    - -
    -
    -
  • -
-
-
-
-
diff --git a/composer.json b/composer.json index ced0910..5ca9427 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "GPL-2.0+", "keywords": ["TYPO3 CMS", "Link Handler", "Links", "Language"], "require": { - "typo3/cms-core": "^9.5 || ^10.4 || ^11.5" + "typo3/cms-core": "^11.5 || ^12.4" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index 0ddb524..27979d7 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,19 +1,18 @@ 'Links to specific languages', - 'description' => 'Allows to select links to pages or content elements for a specific language', - 'category' => 'be', - 'version' => '2.0.2', - 'state' => 'stable', - 'clearcacheonload' => 1, - 'author' => 'b13 GmbH', - 'author_email' => 'typo3@b13.com', - 'author_company' => 'b13 GmbH', - 'constraints' => array( - 'depends' => array( - 'typo3' => '9.5.0-11.5.99', - 'recordlist' => '9.5.0-11.5.99', - ), - ), + 'title' => 'Links to specific languages', + 'description' => 'Allows to select links to pages or content elements for a specific language', + 'category' => 'be', + 'version' => '3.0.0', + 'state' => 'stable', + 'clearcacheonload' => 1, + 'author' => 'b13 GmbH', + 'author_email' => 'typo3@b13.com', + 'author_company' => 'b13 GmbH', + 'constraints' => array( + 'depends' => array( + 'typo3' => '11.5.0-12.4.99', + ), + ), ); diff --git a/ext_localconf.php b/ext_localconf.php index 4621e55..382cb56 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,5 +1,5 @@ Date: Tue, 13 Feb 2024 00:41:50 +0100 Subject: [PATCH 2/3] [TASK] Localize labels --- README.md | 4 ---- Resources/Private/Language/de.locallang_db.xlf | 11 +++++++++++ Resources/Private/Language/locallang_db.xlf | 10 ++++++++++ .../TemplateOverrides/Templates/LinkBrowser/Page.html | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 Resources/Private/Language/de.locallang_db.xlf create mode 100644 Resources/Private/Language/locallang_db.xlf diff --git a/README.md b/README.md index 7c3f526..e8386dc 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,6 @@ For details see the LICENSE file in this repository. If you find an issue, feel free to create an issue on GitHub or a pull request. -## ToDo - -- The labels should be localizable. - ### Credits This extension was created by [Benni Mack](https://github.com/bmack) for [b13 GmbH](https://b13.com). diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf new file mode 100644 index 0000000..ca5d517 --- /dev/null +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -0,0 +1,11 @@ + + + + + + Link to page + Link auf Seite + + + + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf new file mode 100644 index 0000000..b625250 --- /dev/null +++ b/Resources/Private/Language/locallang_db.xlf @@ -0,0 +1,10 @@ + + + + + + Link to page + + + + diff --git a/Resources/Private/TemplateOverrides/Templates/LinkBrowser/Page.html b/Resources/Private/TemplateOverrides/Templates/LinkBrowser/Page.html index 97cfbf1..c2061af 100644 --- a/Resources/Private/TemplateOverrides/Templates/LinkBrowser/Page.html +++ b/Resources/Private/TemplateOverrides/Templates/LinkBrowser/Page.html @@ -12,7 +12,7 @@ -

Link to page

+

From ea64ff178cf27f5ac3aff1c6ea8e3914d8c29fea Mon Sep 17 00:00:00 2001 From: Jochen Date: Tue, 13 Feb 2024 09:40:28 +0100 Subject: [PATCH 3/3] [TASK] Use single quotes --- Classes/LinkHandler/PageLinkHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/LinkHandler/PageLinkHandler.php b/Classes/LinkHandler/PageLinkHandler.php index 24cd357..c4aacb8 100644 --- a/Classes/LinkHandler/PageLinkHandler.php +++ b/Classes/LinkHandler/PageLinkHandler.php @@ -156,7 +156,7 @@ protected function getRecordsOnExpandedPage($pageId) $colPosMapping = []; foreach ($colPosArray as $colPos) { - $colPosMapping[(int)($colPos[1] ?? $colPos["value"])] = $colPos[0] ?? $colPos['label']; + $colPosMapping[(int)($colPos[1] ?? $colPos['value'])] = $colPos[0] ?? $colPos['label']; } // Enrich list of records $groupedContentElements = [];