-
-
Notifications
You must be signed in to change notification settings - Fork 351
/
Labels.php
47 lines (40 loc) · 1.42 KB
/
Labels.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
* This file is part of the "news" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace GeorgRinger\News\Hooks;
use GeorgRinger\News\Service\CategoryService;
/**
* Userfunc to get alternative label
*/
class Labels
{
/**
* Generate additional label for category records
* including the title of the parent category
*
* @param array $params
*/
public function getUserLabelCategory(array &$params): void
{
if (!isset($GLOBALS['TYPO3_REQUEST'], $params['row'], $params['row']['title'])) {
return;
}
$showTranslationInformation = false;
$getVars = $GLOBALS['TYPO3_REQUEST']->getQueryParams();
if (isset($getVars['route']) && $getVars['route'] === '/record/edit'
&& isset($getVars['edit']) && is_array($getVars['edit'])
&& (isset($getVars['edit']['tt_content']) || isset($getVars['edit']['tx_news_domain_model_news']) || isset($getVars['edit']['sys_category']))
) {
$showTranslationInformation = true;
}
if ($showTranslationInformation && is_array($params['row'])) {
$params['title'] = CategoryService::translateCategoryRecord($params['row']['title'], $params['row']);
} else {
$params['title'] = $params['row']['title'];
}
}
}