|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the TYPO3 CMS project. |
|
7
|
|
|
* |
|
8
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
9
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
10
|
|
|
* of the License, or any later version. |
|
11
|
|
|
* |
|
12
|
|
|
* For the full copyright and license information, please read the |
|
13
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
14
|
|
|
* |
|
15
|
|
|
* The TYPO3 project - inspiring people to share! |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace TYPO3\CMS\Dashboard; |
|
19
|
|
|
|
|
20
|
|
|
use TYPO3\CMS\Core\Localization\LanguageService; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @internal |
|
24
|
|
|
*/ |
|
25
|
|
|
class DashboardPreset |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* @var string |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $identifier; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var string |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $title; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $iconIdentifier; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var string |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $description = ''; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var string[] |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $defaultWidgets = []; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @var bool |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $showInWizard = true; |
|
56
|
|
|
|
|
57
|
|
|
public function __construct( |
|
58
|
|
|
string $identifier, |
|
59
|
|
|
string $title, |
|
60
|
|
|
string $description, |
|
61
|
|
|
string $iconIdentifier = 'content-dashboard', |
|
62
|
|
|
array $defaultWidgets = [], |
|
63
|
|
|
bool $showInWizard = true |
|
64
|
|
|
) { |
|
65
|
|
|
$this->identifier = $identifier; |
|
66
|
|
|
$this->title = $title; |
|
67
|
|
|
$this->description = $description; |
|
68
|
|
|
$this->iconIdentifier = $iconIdentifier ?: 'content-dashboard'; |
|
69
|
|
|
$this->defaultWidgets = $defaultWidgets; |
|
70
|
|
|
$this->showInWizard = $showInWizard; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @return string |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getIdentifier(): string |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->identifier; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @return string |
|
83
|
|
|
*/ |
|
84
|
|
|
public function getIconIdentifier(): string |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->iconIdentifier; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @return string |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getTitle(): string |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->getLanguageService()->sl($this->title) ?: $this->title; |
|
95
|
|
|
} |
|
96
|
|
|
/** |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getDescription(): string |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->getLanguageService()->sl($this->description) ?: $this->description; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return string[] |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getDefaultWidgets(): array |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->defaultWidgets; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return bool |
|
114
|
|
|
*/ |
|
115
|
|
|
public function isShowInWizard(): bool |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->showInWizard; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @return LanguageService |
|
122
|
|
|
*/ |
|
123
|
|
|
protected function getLanguageService(): LanguageService |
|
124
|
|
|
{ |
|
125
|
|
|
return $GLOBALS['LANG']; |
|
126
|
|
|
} |
|
127
|
|
|
} |
|
128
|
|
|
|