diff --git a/Classes/Backend/EventListener/CustomFileControlsEventListener.php b/Classes/Backend/EventListener/CustomFileControlsEventListener.php index 6687eea..528494c 100644 --- a/Classes/Backend/EventListener/CustomFileControlsEventListener.php +++ b/Classes/Backend/EventListener/CustomFileControlsEventListener.php @@ -17,6 +17,7 @@ namespace DMK\MkContentAi\Backend\EventListener; +use DMK\MkContentAi\Utility\PermissionsUtility; use TYPO3\CMS\Backend\Form\Event\CustomFileControlsEvent; use TYPO3\CMS\Backend\Form\NodeFactory; use TYPO3\CMS\Core\Imaging\Icon; @@ -36,14 +37,21 @@ final class CustomFileControlsEventListener */ public $iconFactory; - public function __construct() + private PermissionsUtility $permissionsUtility; + + public function __construct(PermissionsUtility $permissionsUtility) { $this->nodeFactory = GeneralUtility::makeInstance(NodeFactory::class); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); + $this->permissionsUtility = $permissionsUtility; } public function handleEvent(CustomFileControlsEvent $event): void { + if (!$this->permissionsUtility->userHasAccessToImageGenerationPromptButton()) { + return; + } + $translatedMessage = LocalizationUtility::translate('labelAiGenerateText', 'mkcontentai') ?? ''; $item = '