|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Neimheadh\SonataAnnotationBundle\Annotation; |
|
6
|
|
|
|
|
7
|
|
|
use Neimheadh\SonataAnnotationBundle\Admin\AnnotationAdmin; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Admin annotation. |
|
11
|
|
|
* |
|
12
|
|
|
* Auto-build the admin service of your model class. |
|
13
|
|
|
* |
|
14
|
|
|
* @Annotation |
|
15
|
|
|
* @Target("CLASS") |
|
16
|
|
|
* |
|
17
|
|
|
* @author Marko Kunic <[email protected]> |
|
18
|
|
|
* @author Mathieu Wambre <[email protected]> |
|
19
|
|
|
*/ |
|
20
|
|
|
final class Admin implements AnnotationInterface |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Admin label. |
|
25
|
|
|
* |
|
26
|
|
|
* @var string |
|
27
|
|
|
*/ |
|
28
|
|
|
public string $label; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Admin model manager type. |
|
32
|
|
|
* |
|
33
|
|
|
* @var string |
|
34
|
|
|
*/ |
|
35
|
|
|
public string $managerType = 'orm'; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Admin group. |
|
39
|
|
|
* |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
public string $group; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Is admin shown in dashboard? |
|
46
|
|
|
* |
|
47
|
|
|
* @var bool |
|
48
|
|
|
*/ |
|
49
|
|
|
public bool $showInDashboard = true; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Is admin is kept open. |
|
53
|
|
|
* |
|
54
|
|
|
* @var bool |
|
55
|
|
|
*/ |
|
56
|
|
|
public bool $keepOpen = false; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Is admin a top menu? |
|
60
|
|
|
* |
|
61
|
|
|
* This option put your admin link directly in the menu and not as a |
|
62
|
|
|
* sub-menu. |
|
63
|
|
|
* |
|
64
|
|
|
* @var bool |
|
65
|
|
|
*/ |
|
66
|
|
|
public bool $onTop = false; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Admin link icon. |
|
70
|
|
|
* |
|
71
|
|
|
* @var string |
|
72
|
|
|
*/ |
|
73
|
|
|
public string $icon; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Admin label translator strategy. |
|
77
|
|
|
* |
|
78
|
|
|
* @var string |
|
79
|
|
|
*/ |
|
80
|
|
|
public string $labelTranslatorStrategy; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Admin label translation catalogue. |
|
84
|
|
|
* |
|
85
|
|
|
* @var string |
|
86
|
|
|
*/ |
|
87
|
|
|
public string $labelCatalogue; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Admin pager type. |
|
91
|
|
|
* |
|
92
|
|
|
* @var string |
|
93
|
|
|
*/ |
|
94
|
|
|
public string $pagerType; |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Admin controller. |
|
98
|
|
|
* |
|
99
|
|
|
* @var string |
|
100
|
|
|
*/ |
|
101
|
|
|
public string $controller; |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Admin service id. |
|
105
|
|
|
* |
|
106
|
|
|
* @var string |
|
107
|
|
|
*/ |
|
108
|
|
|
public string $serviceId; |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Admin service class. |
|
112
|
|
|
* |
|
113
|
|
|
* @var string |
|
114
|
|
|
*/ |
|
115
|
|
|
public string $admin = AnnotationAdmin::class; |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Admin code. |
|
119
|
|
|
* |
|
120
|
|
|
* @var string |
|
121
|
|
|
*/ |
|
122
|
|
|
public string $code; |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* Get service "sonata.admin" tag options. |
|
126
|
|
|
* |
|
127
|
|
|
* @return array<string|bool> |
|
128
|
|
|
*/ |
|
129
|
|
|
public function getTagOptions(): array |
|
130
|
|
|
{ |
|
131
|
|
|
return [ |
|
132
|
|
|
'code' => $this->code ?? null, |
|
133
|
|
|
'controller' => $this->controller ?? null, |
|
134
|
|
|
'manager_type' => $this->managerType, |
|
135
|
|
|
'group' => $this->group ?? null, |
|
136
|
|
|
'label' => $this->label ?? null, |
|
137
|
|
|
'show_in_dashboard' => $this->showInDashboard, |
|
138
|
|
|
'keep_open' => $this->keepOpen, |
|
139
|
|
|
'on_top' => $this->onTop, |
|
140
|
|
|
'icon' => $this->icon ?? null, |
|
141
|
|
|
'label_translator_strategy' => $this->labelTranslatorStrategy ?? null, |
|
142
|
|
|
'label_catalogue' => $this->labelCatalogue ?? null, |
|
143
|
|
|
'pager_type' => $this->pagerType ?? null, |
|
144
|
|
|
]; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
} |
|
148
|
|
|
|