Skip to content

Commit

Permalink
Update AdminModuleController.php (#240)
Browse files Browse the repository at this point in the history
- Switch from Controller attribute to AsController attribute
- Fix language labels for titles and options
- Switch value for setShowLabelText() to a valid boolean
  • Loading branch information
sandoba authored Mar 27, 2024
1 parent e4dc50c commit 25db382
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Classes/Controller/AdminModuleController.php
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\Controller;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
@@ -26,7 +26,7 @@
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Localization\LanguageService;

#[Controller]
#[AsController]
final readonly class AdminModuleController
{
public function __construct(
@@ -42,13 +42,13 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
$allowedOptions = [
'function' => [
'debug' => htmlspecialchars(
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:debug'),
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:debug'),
),
'password' => htmlspecialchars(
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:password'),
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:password'),
),
'index' => htmlspecialchars(
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:index'),
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:index'),
),
],
];
@@ -66,19 +66,19 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
case 'debug':
$moduleTemplate->setTitle(
$title,
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.debug'),
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.debug'),
);
return $this->debugAction($request, $moduleTemplate);
case 'password':
$moduleTemplate->setTitle(
$title,
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.password'),
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.password'),
);
return $this->passwordAction($request, $moduleTemplate);
default:
$moduleTemplate->setTitle(
$title,
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.log'),
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.log'),
);
return $this->indexAction($request, $moduleTemplate);
}
@@ -92,7 +92,7 @@ private function setUpDocHeader(
$list = $buttonBar->makeLinkButton()
->setHref('<uri-builder-path>')
->setTitle('A Title')
->setShowLabelText('Link')
->setShowLabelText(true)
->setIcon($this->iconFactory->getIcon('actions-extension-import', Icon::SIZE_SMALL));
$buttonBar->addButton($list, ButtonBar::BUTTON_POSITION_LEFT, 1);
}

0 comments on commit 25db382

Please sign in to comment.