diff --git a/Build/phpstan/Core12/phpstan-baseline.neon b/Build/phpstan/Core12/phpstan-baseline.neon index 4bc67bfb..f5e3a203 100644 --- a/Build/phpstan/Core12/phpstan-baseline.neon +++ b/Build/phpstan/Core12/phpstan-baseline.neon @@ -5,16 +5,6 @@ parameters: count: 1 path: ../../../Classes/Form/Item/SiteConfigSupportedLanguageItemsProcFunc.php - - - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Hooks\\\\ButtonBarHook\\:\\:buildParamsArrayForListView\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Classes/Hooks/ButtonBarHook.php - - - - message: "#^Parameter \\#1 \\$href of method TYPO3\\\\CMS\\\\Backend\\\\Template\\\\Components\\\\Buttons\\\\LinkButton\\:\\:setHref\\(\\) expects string, Psr\\\\Http\\\\Message\\\\UriInterface given\\.$#" - count: 1 - path: ../../../Classes/Hooks/ButtonBarHook.php - - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\Core12\\\\DatabaseRecordList\\:\\:makeLocalizationPanel\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#" count: 1 diff --git a/Classes/Access/AllowedGlossarySyncAccess.php b/Classes/Access/AllowedGlossarySyncAccess.php deleted file mode 100644 index 4137869f..00000000 --- a/Classes/Access/AllowedGlossarySyncAccess.php +++ /dev/null @@ -1,30 +0,0 @@ - $params - * @param ButtonBar $buttonBar - * - * @return array - * @throws RouteNotFoundException - */ - public function getButtons(array $params, ButtonBar $buttonBar): array - { - $buttons = $params['buttons']; - $queryParams = $GLOBALS['TYPO3_REQUEST']->getQueryParams(); - - if (!isset($queryParams['id']) || $queryParams['id'] === '0') { - return $buttons; - } - - /** @var array{uid: int, doktype?: int, module?: string}|null $page */ - $page = BackendUtility::getRecord( - 'pages', - $queryParams['id'], - 'uid,module,doktype' - ); - - if ( - $page === null - || (int)($page['doktype'] ?? 0) !== PageRepository::DOKTYPE_SYSFOLDER - || ($page['module'] ?? '') !== 'glossary' - ) { - return $buttons; - } - - if (!$this->getBackendUserAuthentication()->check('custom_options', AllowedGlossarySyncAccess::ALLOWED_GLOSSARY_SYNC)) { - return $buttons; - } - - $parameters = $this->buildParamsArrayForListView((int)$page['uid']); - $title = (string)LocalizationUtility::translate( - 'glossary.sync.button.all', - 'DeepltranslateCore' - ); - // Style button - $iconFactory = GeneralUtility::makeInstance(IconFactory::class); - $button = $buttonBar->makeLinkButton(); - $button->setIcon($iconFactory->getIcon( - 'apps-pagetree-folder-contains-glossary', - Icon::SIZE_SMALL - )); - $button->setTitle($title); - $button->setShowLabelText(true); - - $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); - $uri = $uriBuilder->buildUriFromRoute( - 'glossaryupdate', - $parameters - ); - $button->setHref($uri); - - // Register Button and position it - $buttons[ButtonBar::BUTTON_POSITION_LEFT][5][] = $button; - - return $buttons; - } - - private function buildParamsArrayForListView(int $id): array - { - return [ - 'uid' => $id, - 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(), - ]; - } - - private function getBackendUserAuthentication(): BackendUserAuthentication - { - return $GLOBALS['BE_USER']; - } -} diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index a037dc5c..5f9d8041 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -105,12 +105,6 @@ - - Allowed Glossary Sync - - - - diff --git a/Tests/Unit/Access/AllowedGlossarySyncAccessTest.php b/Tests/Unit/Access/AllowedGlossarySyncAccessTest.php deleted file mode 100644 index 9baab490..00000000 --- a/Tests/Unit/Access/AllowedGlossarySyncAccessTest.php +++ /dev/null @@ -1,51 +0,0 @@ -accessInstance = new AllowedGlossarySyncAccess(); - } - - #[Test] - public function hasInterfaceImplementation(): void - { - static::assertInstanceOf(AccessItemInterface::class, $this->accessInstance); - } - - #[Test] - public function getIdentifier(): void - { - static::assertSame('allowedGlossarySync', $this->accessInstance->getIdentifier()); - } - - #[Test] - public function getTitle(): void - { - static::assertIsString($this->accessInstance->getTitle()); - } - - #[Test] - public function getDescription(): void - { - static::assertIsString($this->accessInstance->getDescription()); - } - - #[Test] - public function getIconIdentifier(): void - { - static::assertSame('deepl-logo', $this->accessInstance->getIconIdentifier()); - } -} diff --git a/ext_localconf.php b/ext_localconf.php index e3e7583b..daf82a17 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -56,5 +56,4 @@ $accessRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\WebVision\Deepltranslate\Core\Access\AccessRegistry::class); $accessRegistry->addAccess((new \WebVision\Deepltranslate\Core\Access\AllowedTranslateAccess())); - $accessRegistry->addAccess((new \WebVision\Deepltranslate\Core\Access\AllowedGlossarySyncAccess())); })();