1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace KamiYang\ProjectVersion\Backend\ToolbarItems; |
5
|
|
|
|
6
|
|
|
/* |
7
|
|
|
* This file is part of the ProjectVersion project. |
8
|
|
|
* |
9
|
|
|
* It is free software: you can redistribute it and/or modify |
10
|
|
|
* it under the terms of the GNU General Public License as published by |
11
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
12
|
|
|
* (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* For the full copyright and license information, please read |
15
|
|
|
* LICENSE file that was distributed with this source code. |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use KamiYang\ProjectVersion\Facade\LocalizationUtilityFacade; |
19
|
|
|
use KamiYang\ProjectVersion\Service\ProjectVersionService; |
20
|
|
|
use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem; |
21
|
|
|
use TYPO3\CMS\Core\SingletonInterface; |
22
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
23
|
|
|
use TYPO3\CMS\Core\Utility\StringUtility; |
24
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManager; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class ProjectVersionSlot |
28
|
|
|
*/ |
29
|
|
|
final class ProjectVersionSlot implements SingletonInterface |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @param \TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem $pObj |
33
|
|
|
*/ |
34
|
|
|
public function getProjectVersion(SystemInformationToolbarItem $pObj) |
35
|
|
|
{ |
36
|
|
|
$projectVersion = GeneralUtility::makeInstance(ObjectManager::class) |
37
|
|
|
->get(ProjectVersionService::class) |
38
|
|
|
->getProjectVersion(); |
39
|
|
|
|
40
|
|
|
$version = $projectVersion->getVersion(); |
41
|
|
|
|
42
|
|
|
if (StringUtility::beginsWith($version, 'LLL:')) { |
43
|
|
|
$version = GeneralUtility::makeInstance(LocalizationUtilityFacade::class)->translate($version); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
$pObj->addSystemInformation( |
47
|
|
|
$projectVersion->getTitle(), |
48
|
|
|
$version, |
49
|
|
|
$projectVersion->getIconIdentifier() |
50
|
|
|
); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|