From 19256a00a179f0ef91309cb10aba1845aeca27f5 Mon Sep 17 00:00:00 2001 From: Guido Schmechel Date: Mon, 19 Dec 2022 14:21:51 +0100 Subject: [PATCH] [TASK] v12 Support --- Classes/Form/Element/RedirectElement.php | 27 ++++------ Configuration/TCA/Overrides/pages.php | 15 +++--- README.md | 51 ++++++++++++------- Resources/Private/Language/locallang.xlf | 3 ++ Resources/Private/Templates/Backend/List.html | 18 +++---- composer.json | 7 ++- ext_emconf.php | 4 +- ext_localconf.php | 7 ++- 8 files changed, 72 insertions(+), 60 deletions(-) diff --git a/Classes/Form/Element/RedirectElement.php b/Classes/Form/Element/RedirectElement.php index 483e093..4833858 100644 --- a/Classes/Form/Element/RedirectElement.php +++ b/Classes/Form/Element/RedirectElement.php @@ -15,35 +15,30 @@ class RedirectElement extends AbstractFormElement { - /** - * @var object|\Psr\Log\LoggerAwareInterface|\TYPO3\CMS\Core\SingletonInterface - */ - private $view; + private StandaloneView $view; - /** - * @var object|\Psr\Log\LoggerAwareInterface|\TYPO3\CMS\Core\SingletonInterface - */ - private $redirectRepository; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; + private RedirectRepository $redirectRepository; public function render(): array { $this->redirectRepository = GeneralUtility::makeInstance(RedirectRepository::class); - $this->eventDispatcher = GeneralUtility::makeInstance(EventDispatcherInterface::class); + $eventDispatcher = GeneralUtility::makeInstance(EventDispatcherInterface::class); $this->prepareView(); list($demand, $redirects) = $this->getRedirects(); - $event = $this->eventDispatcher->dispatch(new ModifyRedirectsEvent($redirects)); + $event = $eventDispatcher->dispatch(new ModifyRedirectsEvent($redirects)); $redirects = $event->getRedirects(); + $backendUriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class); + $uriParameters = ['edit' => ['pages' => [$this->data['effectivePid'] => 'edit']]]; + $returnUrl = $backendUriBuilder->buildUriFromRoute('record_edit', $uriParameters); + $this->view->assignMultiple([ 'redirects' => $redirects, 'demand' => $demand, - 'pagination' => $this->preparePagination($demand) + 'pagination' => $this->preparePagination($demand), + 'returnUrl' => $returnUrl ]); $result = $this->initializeResultArray(); @@ -97,7 +92,7 @@ protected function getRedirects(): array $redirectsWithSlugAsIdentifier ?? [] ); } - return array($demand, $redirects); + return [$demand, $redirects]; } /** diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index 0c02b36..3949a18 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -1,16 +1,15 @@ [ 'exclude' => true, - 'label' => '', + 'label' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang.xlf:redirect_list', 'config' => [ 'type' => 'user', 'renderType' => 'listRedirects', @@ -19,16 +18,16 @@ ]; // Add to TCA pages - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( + ExtensionManagementUtility::addTCAcolumns( $table, $temporaryColumns ); // Add additional tab for page properties - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + ExtensionManagementUtility::addToAllTCAtypes( $table, - '--div--;LLL:EXT:redirect_tab/Resources/Private/Language/locallang.xlf:tab,' . implode(',', array_keys($temporaryColumns)), + '--div--;LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang.xlf:tab,' . implode(',', array_keys($temporaryColumns)), '', '' ); diff --git a/README.md b/README.md index 42452a6..f04c40a 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,6 @@ * Show redirects of the respective page in a tab in the page properties -**Hint**: - -This extension is new and should first be tested in a dev environment. Feedback is welcome. - ## 2 Usage ### 2.1 Installation @@ -26,26 +22,31 @@ composer require ayacoo/redirect-tab ### 3.1 Versions and support -| News | TYPO3 | PHP | Support / Development | -| ----------- | ---------- | ----------|---------------------------------------- | -| dev-main | 11.x - 12.x| 7.4 - 8.0 | unstable development branch | -| 2.x | 11.x | 7.4 - 8.0 | features, bugfixes, security updates | -| 1.x | 10.x | 7.2 - 7.4 | features, bugfixes, security updates | - +| redirect_tab | TYPO3 | PHP | Support / Development | +|------|---------|-----------|-----------------------------| +| 3.x | 12.x | 8.1 | features, bugfixes, security updates | +| 2.x | 11.x | 7.4 - 8.0 | bugfixes, security updates | +| 1.x | 10.x | 7.2 - 7.4 | no support any more | ### 3.2 Release Management -reidrect_tab uses [**semantic versioning**][2], which means, that -* **bugfix updates** (e.g. 1.0.0 => 1.0.1) just includes small bugfixes or security relevant stuff without breaking changes, -* **minor updates** (e.g. 1.0.0 => 1.1.0) includes new features and smaller tasks without breaking changes, -* and **major updates** (e.g. 1.0.0 => 2.0.0) breaking changes which can be refactorings, features or bugfixes. +redirect_tab uses [**semantic versioning**][2], which means, that + +* **bugfix updates** (e.g. 1.0.0 => 1.0.1) just includes small bugfixes or + security relevant stuff without breaking changes, +* **minor updates** (e.g. 1.0.0 => 1.1.0) includes new features and smaller + tasks without breaking changes, +* and **major updates** (e.g. 1.0.0 => 2.0.0) breaking changes which can be + refactorings, features or bugfixes. ### 3.3 Contribution -**Pull Requests** are gladly welcome! Nevertheless please don't forget to add an issue and connect it to your pull requests. This +**Pull Requests** are gladly welcome! Nevertheless please don't forget to add an +issue and connect it to your pull requests. This is very helpful to understand what kind of issue the **PR** is going to solve. -**Bugfixes**: Please describe what kind of bug your fix solve and give us feedback how to reproduce the issue. We're going +**Bugfixes**: Please describe what kind of bug your fix solve and give us +feedback how to reproduce the issue. We're going to accept only bugfixes if we can reproduce the issue. ## 4 Developer corner @@ -54,7 +55,10 @@ to accept only bugfixes if we can reproduce the issue. **ModifyRedirectsEvent** -The ModifyRedirectsEvent offers the possibility to influence the resultset of the redirects. For example, the LIKE %Value% search from the core sometimes displays incorrect hits for the respective page. These can be filtered out with the event. +The ModifyRedirectsEvent offers the possibility to influence the resultset of +the redirects. For example, the LIKE %Value% search from the core sometimes +displays incorrect hits for the respective page. These can be filtered out with +the event. Example for registration: @@ -71,10 +75,19 @@ services: ## 5 Thanks / Notices -Special thanks to Georg Ringer and his [news][3] extension. A good template to build a TYPO3 extension. Here, for example, the structure of README.md is used. +Special thanks to Georg Ringer and his [news][3] extension. A good template to +build a TYPO3 extension. Here, for example, the structure of README.md is used. -This extension is a result of a core proof of concept and uses many parts of the TYPO3 core, especially parts of the redirect extension. +This extension is a result of a core proof of concept and uses many parts of the +TYPO3 core, especially parts of the redirect extension. [1]: https://getcomposer.org/ + [2]: https://semver.org/ + [3]: https://github.com/georgringer/news + +## 6 Support + +If you are happy with the extension and would like to support it in any way, I +would appreciate the support of social institutions. diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 712c353..11a7180 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -6,6 +6,9 @@ Redirects + + List of linked redirects for this page + diff --git a/Resources/Private/Templates/Backend/List.html b/Resources/Private/Templates/Backend/List.html index cc72845..609c382 100644 --- a/Resources/Private/Templates/Backend/List.html +++ b/Resources/Private/Templates/Backend/List.html @@ -9,9 +9,9 @@ - - - + + + @@ -37,7 +37,7 @@ - + {redirect.source_path -> f:format.crop(maxCharacters:100)} @@ -62,17 +62,17 @@ - + - + - +

- +
diff --git a/composer.json b/composer.json index f08255d..8895a64 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "ayacoo/redirect-tab", "type": "typo3-cms-extension", - "version": "2.1.0", + "version": "3.0.0", "description": "Show TYPO3 redirects in the page properties", "authors": [ { @@ -12,9 +12,8 @@ "homepage": "https://www.ayacoo.de/", "license": "GPL-2.0-or-later", "require": { - "php": "^7.4 || ^8.0", - "typo3/cms-core": "^11.5", - "typo3/cms-redirects": "^11.5" + "php": ">=8.1", + "typo3/cms-core": "^12.0" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index 0c1ddad..d157967 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -8,10 +8,10 @@ 'author_email' => 'info@ayacoo.de', 'state' => 'beta', 'clearCacheOnLoad' => 0, - 'version' => '2.1.0', + 'version' => '3.0.0', 'constraints' => [ 'depends' => [ - 'typo3' => '11.0.0-11.99.99', + 'typo3' => '12.0.0-12.99.99', ], 'conflicts' => [ ], diff --git a/ext_localconf.php b/ext_localconf.php index ebd332c..48d7efc 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,10 +1,13 @@ 'listRedirects', 'priority' => 40, - 'class' => \Ayacoo\RedirectTab\Form\Element\RedirectElement::class, + 'class' => RedirectElement::class, ]; })();