Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add version to systeminformation #14

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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