-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from visuellverstehen/add-version-to-system-in…
…formation feat: add version to systeminformation
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
Classes/EventListener/AddVersionToSystemInformationToolbar.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace VV\T3meilisearch\EventListener; | ||
|
||
use MeiliSearch\Client; | ||
use TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent; | ||
use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus; | ||
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class AddVersionToSystemInformationToolbar | ||
{ | ||
public function __invoke(SystemInformationToolbarCollectorEvent $event): void | ||
{ | ||
$settings = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('t3meilisearch'); | ||
$client = new Client($settings['host'], $settings['apiKey']); | ||
$version = $client->version()['pkgVersion']; | ||
|
||
$event->getToolbarItem()->addSystemInformation( | ||
'Meilisearch Version', | ||
$version, | ||
'actions-search', | ||
InformationStatus::STATUS_NOTICE | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters