Skip to content

Commit

Permalink
Merge pull request #14 from visuellverstehen/add-version-to-system-in…
Browse files Browse the repository at this point in the history
…formation

feat: add version to systeminformation
  • Loading branch information
runepiper authored May 7, 2024
2 parents 0e55997 + 6880640 commit abdaa05
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Classes/EventListener/AddVersionToSystemInformationToolbar.php
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
);
}
}
4 changes: 4 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ services:

VV\T3meilisearch\:
resource: '../Classes/*'

VV\T3meilisearch\EventListener\AddVersionToSystemInformationToolbar:
tags:
- name: event.listener

0 comments on commit abdaa05

Please sign in to comment.