diff --git a/Classes/Event/Listener/RenderTranslatedFlagInFrontendPreviewMode.php b/Classes/Event/Listener/RenderTranslatedFlagInFrontendPreviewMode.php index eaffb0b0..d91f48c5 100644 --- a/Classes/Event/Listener/RenderTranslatedFlagInFrontendPreviewMode.php +++ b/Classes/Event/Listener/RenderTranslatedFlagInFrontendPreviewMode.php @@ -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 { diff --git a/Classes/Hooks/DeeplPreviewFlagGeneratePageHook.php b/Classes/Hooks/DeeplPreviewFlagGeneratePageHook.php deleted file mode 100644 index 90b73233..00000000 --- a/Classes/Hooks/DeeplPreviewFlagGeneratePageHook.php +++ /dev/null @@ -1,59 +0,0 @@ -getContext()->hasAspect('frontend.preview') - && $controller->getContext()->getPropertyFromAspect('frontend.preview', 'isPreview'); - if ( - !$isInPreviewMode - || $controller->getContext()->getPropertyFromAspect('workspace', 'isOffline', false) - || ($controller->config['config']['disablePreviewNotification'] ?? false) - || ( - isset($controller->page['tx_wvdeepltranslate_translated_time']) - && $controller->page['tx_wvdeepltranslate_translated_time'] === 0 - ) - ) { - return; - } - - $messagePreviewLabel = $controller->config['config']['deepl_message_preview'] ?? ''; - if ($messagePreviewLabel === '') { - $messagePreviewLabel = 'Translated with DeepL'; - } - - $styles = []; - $styles[] = 'position: fixed'; - $styles[] = 'top: 65px'; - $styles[] = 'right: 15px'; - $styles[] = 'padding: 8px 18px'; - $styles[] = 'background: #006494'; - $styles[] = 'border: 1px solid #006494'; - $styles[] = 'font-family: sans-serif'; - $styles[] = 'font-size: 14px'; - $styles[] = 'font-weight: bold'; - $styles[] = 'color: #fff'; - $styles[] = 'z-index: 20000'; - $styles[] = 'user-select: none'; - $styles[] = 'pointer-events: none'; - $styles[] = 'text-align: center'; - $styles[] = 'border-radius: 2px'; - $message = '
' . htmlspecialchars($messagePreviewLabel) . '
'; - - $controller->content = str_ireplace('', $message . '', $controller->content); - } -} diff --git a/Configuration/Services.php b/Configuration/Services.php index d122d354..1ce04c01 100644 --- a/Configuration/Services.php +++ b/Configuration/Services.php @@ -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; @@ -35,8 +34,6 @@ use WebVision\Deepltranslate\Core\Widgets\UsageWidget; return function (ContainerConfigurator $containerConfigurator, ContainerBuilder $containerBuilder) { - $typo3version = new Typo3Version(); - $services = $containerConfigurator ->services(); $services->defaults() @@ -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. diff --git a/ext_localconf.php b/ext_localconf.php index 76dff73f..5ca4866d 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -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,