Skip to content

Commit

Permalink
[FEATURE] Replace severity numbers with constants
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbrackets committed Sep 9, 2024
1 parent 00f79f7 commit db935fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Classes/Event/Listener/UsageToolBarEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent;
use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus;
use TYPO3\CMS\Core\Localization\LanguageService;
use WebVision\WvDeepltranslate\Exception\ApiKeyNotSetException;
use WebVision\WvDeepltranslate\Service\UsageService;
Expand Down Expand Up @@ -52,6 +53,7 @@ public function __invoke(SystemInformationToolbarCollectorEvent $systemInformati
$title,
sprintf($message, $this->formatNumber($usage->character->count), $this->formatNumber($usage->character->limit)),
'actions-localize-deepl',
InformationStatus::STATUS_NOTICE,
);
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Hooks/UsageProcessAfterFinishHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function processCmdmap_afterFinish(DataHandler $dataHandler): void
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$notificationQueue = $flashMessageService->getMessageQueueByIdentifier();

$severity = -1; // Info
$severity = FlashMessage::INFO;
if ($this->usageService->isTranslateLimitExceeded()) {
$severity = 1; // Warning
$severity = FlashMessage::WARNING;
}

$flashMessage = GeneralUtility::makeInstance(
Expand Down

0 comments on commit db935fe

Please sign in to comment.