Skip to content

Commit

Permalink
[!!!][TASK] Remove obsolete DeeplPreviewFlagGeneratePageHook
Browse files Browse the repository at this point in the history
Since TYPO3 v12 `contentPostProc-all` hook is not called and replaced
with PSR-14 event `AfterCacheableContentIsGeneratedEvent`, which has
been respected with

* #397
* #398

TYPO3 v11 support has been removed and this change cleansup introduced
dual version code with upporting the bugfix as a housekeeping change.
Further, the now obsolete hook is completly removed.

Related: #397
Related: #398
  • Loading branch information
sbuerk committed Dec 14, 2024
1 parent 95d0636 commit a861424
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
use TYPO3\CMS\Frontend\Event\AfterCacheableContentIsGeneratedEvent;
use WebVision\Deepltranslate\Core\Hooks\DeeplPreviewFlagGeneratePageHook;

/**
* Event listener to render the frontend preview flag information.
*
* TYPO3 v12+ only and this is the counter-part of the {@see DeeplPreviewFlagGeneratePageHook} for older TYPO3 versions.
* https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Breaking-97862-HooksRelatedToGeneratingPageContentRemoved.html
* @internal for `deepltranslate-core` internal usage and not part of public API.
*/
final class RenderTranslatedFlagInFrontendPreviewMode
{
Expand Down
59 changes: 0 additions & 59 deletions Classes/Hooks/DeeplPreviewFlagGeneratePageHook.php

This file was deleted.

22 changes: 8 additions & 14 deletions Configuration/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\DependencyInjection\SingletonPass;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Dashboard\WidgetRegistry;
use WebVision\Deepltranslate\Core\Client;
use WebVision\Deepltranslate\Core\ClientInterface;
Expand All @@ -35,8 +34,6 @@
use WebVision\Deepltranslate\Core\Widgets\UsageWidget;

return function (ContainerConfigurator $containerConfigurator, ContainerBuilder $containerBuilder) {
$typo3version = new Typo3Version();

$services = $containerConfigurator
->services();
$services->defaults()
Expand Down Expand Up @@ -162,17 +159,14 @@
]
);

if ((new Typo3Version())->getMajorVersion() >= 12) {
// @todo Unnest this in next major when TYPO3 v11 support has been removed.
$services
->set(RenderTranslatedFlagInFrontendPreviewMode::class)
->tag(
'event.listener',
[
'identifier' => 'deepltranslate-core/render-translated-flag-in-frontend-preview-mode',
]
);
}
$services
->set(RenderTranslatedFlagInFrontendPreviewMode::class)
->tag(
'event.listener',
[
'identifier' => 'deepltranslate-core/render-translated-flag-in-frontend-preview-mode',
]
);

/**
* Check if WidgetRegistry is defined, which means that EXT:dashboard is available.
Expand Down
6 changes: 0 additions & 6 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList']['deepl']
= \WebVision\Deepltranslate\Core\Hooks\TCEmainHook::class;

if ($typo3version->getMajorVersion() < 12) {
// @todo Remove when TYPO3 v11 support is removed.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']['deepl-1675946132'] =
\WebVision\WvDeepltranslate\Hooks\DeeplPreviewFlagGeneratePageHook::class . '->renderDeeplPreviewFlag';
}

//xclass localizationcontroller for localizeRecords() and process() action
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\Controller\Page\LocalizationController::class] = [
'className' => \WebVision\Deepltranslate\Core\Override\LocalizationController::class,
Expand Down

0 comments on commit a861424

Please sign in to comment.