Skip to content

Commit

Permalink
feat: add version to systeminformation
Browse files Browse the repository at this point in the history
  • Loading branch information
runepiper committed Apr 24, 2024
1 parent 0e55997 commit 04440fc
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 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;
use MeiliSearch\Client;

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 04440fc

Please sign in to comment.