From e03c859796af68d0beb43506a67f5c778820b6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Sun, 7 Jun 2026 20:00:29 +0200 Subject: [PATCH] [TASK] DPL-158: Move TYPO3 v13 only event listener to `Core13/` This change moves TYPO3 v13 only event listener into the dedicatged `Core13/` namespace only loaded and executed with TYPO3 v13. One event listener is kept and marked with a todo for later re-evaluation if still required or not and in case moved at a later point. Follow-up changes possible moves additional code into the dedicated namespace if required to restrict the scope of the this change only to event listeneres as preparation to raise `EXT:deepl_base` dependency and preapre towards TYPO3 v14 support. --- .../RenderWriteSelectEventListener.php | 3 ++ Configuration/Services.php | 32 +++++++++++++++++++ .../ApplyLocalizationModesEventListener.php | 4 +-- ...WritePageViewRegistrationEventListener.php | 4 ++- .../ProcessLocalizationModeEventListener.php | 4 +-- composer.json | 4 ++- 6 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 Configuration/Services.php rename {Classes => Core13}/Event/Listener/ApplyLocalizationModesEventListener.php (93%) rename {Classes => Core13}/Event/Listener/DeeplWritePageViewRegistrationEventListener.php (97%) rename {Classes => Core13}/Event/Listener/ProcessLocalizationModeEventListener.php (92%) diff --git a/Classes/Event/Listener/RenderWriteSelectEventListener.php b/Classes/Event/Listener/RenderWriteSelectEventListener.php index 84d3b6c..d9e31fc 100644 --- a/Classes/Event/Listener/RenderWriteSelectEventListener.php +++ b/Classes/Event/Listener/RenderWriteSelectEventListener.php @@ -9,6 +9,9 @@ use TYPO3\CMS\Core\Site\Entity\Site; use WebVision\DeeplWrite\Generator\WriteDropdownGenerator; +/** + * @todo Verify if this is still needed for TYPO3v14 and if not move at a later point. + */ final readonly class RenderWriteSelectEventListener { public function __construct( diff --git a/Configuration/Services.php b/Configuration/Services.php new file mode 100644 index 0000000..9330e08 --- /dev/null +++ b/Configuration/Services.php @@ -0,0 +1,32 @@ +getMajorVersion(); + $services = $containerConfigurator->services(); + + //================================================================================================================== + // The default configuration: allow autowire and autoconfigure, + // no need to make every class public. + //================================================================================================================== + $services->defaults() + ->autowire() + ->autoconfigure() + ->private(); // "private" is the default and can safely be omitted + //================================================================================================================== + + //================================================================================================================== + // Define the location of the PHP sources of our extension. + // In addition, exclude Extbase models that should never be used via DI. + //================================================================================================================== + $services->load( + sprintf('WebVision\\DeeplWrite\\Core%s\\', $majorVersion), + sprintf(__DIR__ . '/../Core%s/', $majorVersion), + ); + //================================================================================================================== +}; diff --git a/Classes/Event/Listener/ApplyLocalizationModesEventListener.php b/Core13/Event/Listener/ApplyLocalizationModesEventListener.php similarity index 93% rename from Classes/Event/Listener/ApplyLocalizationModesEventListener.php rename to Core13/Event/Listener/ApplyLocalizationModesEventListener.php index 1cb03f4..02ce7a4 100644 --- a/Classes/Event/Listener/ApplyLocalizationModesEventListener.php +++ b/Core13/Event/Listener/ApplyLocalizationModesEventListener.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace WebVision\DeeplWrite\Event\Listener; +namespace WebVision\DeeplWrite\Core13\Event\Listener; use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Information\Typo3Version; @@ -14,7 +14,7 @@ * event {@see GetLocalizationModesEvent} dispatched by extension `deepl_base` * in {@see LocalizationController::dispatchGetLocalizationModesEvent()}. * - * @todo Move to `Core13/` only code execution. + * @internal and not part of public API. */ final class ApplyLocalizationModesEventListener { diff --git a/Classes/Event/Listener/DeeplWritePageViewRegistrationEventListener.php b/Core13/Event/Listener/DeeplWritePageViewRegistrationEventListener.php similarity index 97% rename from Classes/Event/Listener/DeeplWritePageViewRegistrationEventListener.php rename to Core13/Event/Listener/DeeplWritePageViewRegistrationEventListener.php index b687e32..4be64f3 100644 --- a/Classes/Event/Listener/DeeplWritePageViewRegistrationEventListener.php +++ b/Core13/Event/Listener/DeeplWritePageViewRegistrationEventListener.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace WebVision\DeeplWrite\Event\Listener; +namespace WebVision\DeeplWrite\Core13\Event\Listener; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Routing\UriBuilder; @@ -15,6 +15,8 @@ /** * This EventListener registers the partial and the dropdown options * for the translation/write optimization dropdown in PageView + * + * @internal and not part of public API. */ final class DeeplWritePageViewRegistrationEventListener { diff --git a/Classes/Event/Listener/ProcessLocalizationModeEventListener.php b/Core13/Event/Listener/ProcessLocalizationModeEventListener.php similarity index 92% rename from Classes/Event/Listener/ProcessLocalizationModeEventListener.php rename to Core13/Event/Listener/ProcessLocalizationModeEventListener.php index 75446b3..9df7614 100644 --- a/Classes/Event/Listener/ProcessLocalizationModeEventListener.php +++ b/Core13/Event/Listener/ProcessLocalizationModeEventListener.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace WebVision\DeeplWrite\Event\Listener; +namespace WebVision\DeeplWrite\Core13\Event\Listener; use TYPO3\CMS\Core\Attribute\AsEventListener; use WebVision\Deepl\Base\Event\LocalizationProcessPrepareDataHandlerCommandMapEvent; /** - * @todo Move to `Core13/` only code execution. + * @internal and not part of public API. */ final class ProcessLocalizationModeEventListener { diff --git a/composer.json b/composer.json index d23b6d6..e9b38fe 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,9 @@ }, "autoload": { "psr-4": { - "WebVision\\DeeplWrite\\": "Classes/" + "WebVision\\DeeplWrite\\": "Classes/", + "WebVision\\DeeplWrite\\Core13\\": "Core13/", + "WebVision\\DeeplWrite\\Core14\\": "Core14/" } }, "autoload-dev": {