Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Classes/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

namespace WebVision\DeeplWrite\Configuration;

use Symfony\Component\DependencyInjection\Attribute\AsAlias;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

#[AsAlias(id: ConfigurationInterface::class, public: true)]
final class Configuration implements ConfigurationInterface
{
private string $apiKey;
Expand Down
2 changes: 2 additions & 0 deletions Classes/Controller/CkEditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory;
use TYPO3\CMS\Fluid\View\StandaloneView;
Expand All @@ -21,6 +22,7 @@
* This class is meant to be used within the DeepL write extension and therefore
* no public API. Endpoints can change without further information.
*/
#[AsController]
final class CkEditorController
{
public function __construct(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace WebVision\DeeplWrite\Event\Listener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Information\Typo3Version;
use WebVision\Deepl\Base\Event\GetLocalizationModesEvent;
use WebVision\Deepl\Base\Localization\LocalizationMode;
Expand All @@ -12,9 +13,15 @@
* Provides DeepL Write related localization modes by listening to the PSR-14
* event {@see GetLocalizationModesEvent} dispatched by extension `deepl_base`
* in {@see LocalizationController::dispatchGetLocalizationModesEvent()}.
*
* @todo Move to `Core13/` only code execution.
*/
final class ApplyLocalizationModesEventListener
{
#[AsEventListener(
identifier: 'deeplwrite/deeplwrite-localization-modes-determine',
after: 'deepl-base/determine-default-typo3-localization-modes',
)]
public function __invoke(GetLocalizationModesEvent $event): void
{
$majorVersion = (new Typo3Version())->getMajorVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\View\PageLayoutContext;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use WebVision\Deepl\Base\Event\ViewHelpers\ModifyInjectVariablesViewHelperEvent;
use WebVision\DeeplWrite\Domain\Enum\RephraseSupportedDeepLLanguage;
Expand All @@ -17,6 +18,10 @@
*/
final class DeeplWritePageViewRegistrationEventListener
{
#[AsEventListener(
identifier: 'deepl-write/translation-dropdown',
after: 'deepl-base/default-translation, deepltranslate-core/translation-dropdown',
)]
public function __invoke(ModifyInjectVariablesViewHelperEvent $event): void
{
if ($event->getIdentifier() !== 'languageTranslationDropdown') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@

namespace WebVision\DeeplWrite\Event\Listener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use WebVision\Deepl\Base\Event\LocalizationProcessPrepareDataHandlerCommandMapEvent;

/**
* @todo Move to `Core13/` only code execution.
*/
final class ProcessLocalizationModeEventListener
{
#[AsEventListener(
identifier: 'deeplwrite/deeplwrite-localization-modes-process',
after: 'deepl-base/process-default-typo3-localization-modes',
)]
public function __invoke(LocalizationProcessPrepareDataHandlerCommandMapEvent $event): void
{
// @todo Consider to drop `deepltranslateauto` mode.
Expand Down
10 changes: 5 additions & 5 deletions Classes/Event/Listener/RenderWriteSelectEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
use TYPO3\CMS\Core\Site\Entity\Site;
use WebVision\DeeplWrite\Generator\WriteDropdownGenerator;

#[AsEventListener(
identifier: 'deeplWrite/render-select'
)]
final class RenderWriteSelectEventListener
final readonly class RenderWriteSelectEventListener
{
public function __construct(
private readonly WriteDropdownGenerator $writeDropdownGenerator,
private WriteDropdownGenerator $writeDropdownGenerator,
) {
}

#[AsEventListener(
identifier: 'deeplWrite/render-select'
)]
public function __invoke(RenderAdditionalContentToRecordListEvent $event): void
{
$request = $event->getRequest();
Expand Down
2 changes: 2 additions & 0 deletions Classes/Hooks/PageRendererHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

namespace WebVision\DeeplWrite\Hooks;

use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Page\PageRenderer;

#[Autoconfigure(public: true)]
final class PageRendererHook
{
/**
Expand Down
2 changes: 2 additions & 0 deletions Classes/Hooks/WriteHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace WebVision\DeeplWrite\Hooks;

use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Site\SiteFinder;
Expand All @@ -14,6 +15,7 @@
use WebVision\DeeplWrite\Service\DeeplService;
use WebVision\DeeplWrite\Service\LanguageService;

#[Autoconfigure(public: true)]
final class WriteHook
{
public function __construct(
Expand Down
30 changes: 0 additions & 30 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,3 @@ services:

WebVision\DeeplWrite\:
resource: '../Classes/*'

WebVision\DeeplWrite\Hooks\WriteHook:
public: true

WebVision\DeeplWrite\Controller\CkEditorController:
public: true

WebVision\DeeplWrite\Configuration\ConfigurationInterface:
class: WebVision\DeeplWrite\Configuration\Configuration

WebVision\DeeplWrite\Event\Listener\ApplyLocalizationModesEventListener:
tags:
- name: 'event.listener'
identifier: 'deeplwrite/deeplwrite-localization-modes-determine'
event: WebVision\Deepl\Base\Event\GetLocalizationModesEvent
after: 'deepl-base/determine-default-typo3-localization-modes'

WebVision\DeeplWrite\Event\Listener\ProcessLocalizationModeEventListener:
tags:
- name: 'event.listener'
identifier: 'deeplwrite/deeplwrite-localization-modes-process'
event: WebVision\Deepl\Base\Event\LocalizationProcessPrepareDataHandlerCommandMapEvent
after: 'deepl-base/process-default-typo3-localization-modes'

WebVision\DeeplWrite\Event\Listener\DeeplWritePageViewRegistrationEventListener:
tags:
- name: 'event.listener'
identifier: 'deepl-write/translation-dropdown'
event: WebVision\Deepl\Base\Event\ViewHelpers\ModifyInjectVariablesViewHelperEvent
after: 'deepl-base/default-translation, deepltranslate-core/translation-dropdown'
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"friendsofphp/php-cs-fixer": "^3.70",
"helmich/typo3-typoscript-lint": "^3.1.0",
"phpstan/phpstan": "^1.12.33",
"phpunit/phpunit": "^10.5.63",
"phpunit/phpunit": "^10.5",
"saschaegerer/phpstan-typo3": "^1.10.2",
"typo3/testing-framework": "^8.3.1"
},
Expand Down