Skip to content

Commit

Permalink
Bugfix: Toolbar never shows active (#72)
Browse files Browse the repository at this point in the history
Relates: #69
  • Loading branch information
christophlehmann authored Oct 26, 2022
1 parent 5c643b6 commit 83b63b0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Networkteam\SentryClient\EventListener;

use Networkteam\SentryClient\Client;
use Networkteam\SentryClient\ProductionExceptionHandler;
use Networkteam\SentryClient\Service\ConfigurationService;
use TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent;
use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus;
Expand All @@ -12,9 +13,10 @@ class SystemInformationToolbarCollectorEventListener
{
public function __invoke(SystemInformationToolbarCollectorEvent $event): void
{
$isActive = Client::isInitialized();
$isActive = !empty(ConfigurationService::getDsn())
&& $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] === ProductionExceptionHandler::class;
$label = $this->getLanguageService()->sL(
'LLL:EXT:sentry_client/Resources/Private/Language/locallang_be.xlf:' . ($isActive ? 'systeminformation.active' : 'systeminformation.inactive')
'LLL:EXT:sentry_client/Resources/Private/Language/locallang_be.xlf:systeminformation.' . ($isActive ? 'active' : 'inactive')
);

$event->getToolbarItem()->addSystemInformation(
Expand Down

0 comments on commit 83b63b0

Please sign in to comment.