Passed
Push — master ( 6d9231...72f38d )
by Romain
05:38 queued 02:28
created

getNotificationTcaServiceClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * Copyright (C) 2018
5
 * Nathan Boiron <[email protected]>
6
 * Romain Canon <[email protected]>
7
 *
8
 * This file is part of the TYPO3 NotiZ project.
9
 * It is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU General Public License, either
11
 * version 3 of the License, or any later version.
12
 *
13
 * For the full copyright and license information, see:
14
 * http://www.gnu.org/licenses/gpl-3.0.html
15
 */
16
17
namespace CuyZ\Notiz\Domain\Notification\Log\Application\EntityLog\TCA;
18
19
use CuyZ\Notiz\Core\Notification\TCA\EntityTcaWriter;
20
21
class EntityLogTcaWriter extends EntityTcaWriter
22
{
23
    const LOG_LLL = 'LLL:EXT:notiz/Resources/Private/Language/Notification/Log/Entity.xlf';
24
25
    /**
26
     * @return string
27
     */
28
    protected function getNotificationTcaServiceClass()
29
    {
30
        return EntityLogTcaService::class;
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    protected function getChannelLabel()
37
    {
38
        return self::LOG_LLL . ':field.logger';
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44
    protected function buildTcaArray()
45
    {
46
        return [
47
            'ctrl' => $this->getDefaultCtrl(),
48
49
            'palettes' => [
50
                'content' => [
51
                    'showitem' => 'message,markers',
52
                    'canNotCollapse' => true,
53
                ],
54
                'levels' => [
55
                    'showitem' => 'level,levels_descriptions',
56
                    'canNotCollapse' => true,
57
                ],
58
            ],
59
60
            'types' => [
61
                '0' => [
62
                    'showitem' => '
63
                        error_message,
64
                        title, description, sys_language_uid, hidden,
65
                        --div--;' . self::LLL_TABS . ':tab.event,
66
                            event, event_configuration_flex,
67
                        --div--;' . self::LLL_TABS . ':tab.channel,
68
                            channel,
69
                        --div--;' . self::LOG_LLL . ':tab.log,
70
                            --palette--;' . self::LOG_LLL . ':palette.content;content,
71
                            --palette--;' . self::LOG_LLL . ':palette.levels;levels',
72
                ],
73
            ],
74
75
            'columns' => [
76
                'message' => [
77
                    'exclude' => 1,
78
                    'label' => self::LOG_LLL . ':field.message',
79
                    'config' => [
80
                        'type' => 'input',
81
                        'size' => 255,
82
                        'eval' => 'trim,required',
83
                    ],
84
                ],
85
86
                'level' => [
87
                    'exclude' => 1,
88
                    'label' => self::LOG_LLL . ':field.level',
89
                    'l10n_mode' => 'exclude',
90
                    'l10n_display' => 'defaultAsReadonly',
91
                    'config' => [
92
                        'type' => 'radio',
93
                        'items' => [],
94
                        'itemsProcFunc' => EntityLogTcaService::class . '->getLogLevelsList',
95
                        'eval' => 'required',
96
                    ],
97
                ],
98
99
                'levels_descriptions' => [
100
                    'exclude' => 1,
101
                    'label' => self::LOG_LLL . ':field.levels_descriptions_title',
102
                    'l10n_display' => 'defaultAsReadonly',
103
                    'config' => [
104
                        'type' => 'user',
105
                        'userFunc' => EntityLogTcaService::class . '->getLogLevelsDescriptions',
106
                    ],
107
                ],
108
109
            ],
110
        ];
111
    }
112
113
    /**
114
     * @return string
115
     */
116
    protected function getEntityTitle()
117
    {
118
        return self::LOG_LLL . ':title';
119
    }
120
}
121