1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the core-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\CoreBundle\Manager; |
13
|
|
|
|
14
|
|
|
use ReflectionException; |
15
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\ApplicationThemeProviderInterface; |
16
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\BreadcrumbsThemeProviderInterface; |
17
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\FooterThemeProviderInterface; |
18
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\HookDropDownThemeProviderInterface; |
19
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\NavigationThemeProviderInterface; |
20
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\NotificationsDropDownThemeProviderInterface; |
21
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\SearchThemeProviderInterface; |
22
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\TasksDropDownThemeProviderInterface; |
23
|
|
|
use WBW\Bundle\CoreBundle\Provider\Theme\UserInfoThemeProviderInterface; |
24
|
|
|
use WBW\Library\Core\Argument\ObjectHelper; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Theme manager. |
28
|
|
|
* |
29
|
|
|
* @author webeweb <https://github.com/webeweb/> |
30
|
|
|
* @package WBW\Bundle\CoreBundle\Manager |
31
|
|
|
*/ |
32
|
|
|
class ThemeManager extends AbstractThemeManager { |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Service name. |
36
|
|
|
* |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
const SERVICE_NAME = "webeweb.core.manager.theme"; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Get the application theme provider. |
43
|
|
|
* |
44
|
|
|
* @return ApplicationThemeProviderInterface Returns the application theme provider. |
45
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
46
|
|
|
*/ |
47
|
|
|
public function getApplicationThemeProvider() { |
48
|
|
|
return $this->getProvider(ApplicationThemeProviderInterface::class); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get the breadcrumbs theme provider. |
53
|
|
|
* |
54
|
|
|
* @return BreadcrumbsThemeProviderInterface Returns the breadcrumbs theme provider. |
55
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
56
|
|
|
*/ |
57
|
|
|
public function getBreadcrumbsThemeProvider() { |
58
|
|
|
return $this->getProvider(BreadcrumbsThemeProviderInterface::class); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get the footer theme provider. |
63
|
|
|
* |
64
|
|
|
* @return FooterThemeProviderInterface Returns the footer theme provider. |
65
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
66
|
|
|
*/ |
67
|
|
|
public function getFooterThemeProvider() { |
68
|
|
|
return $this->getProvider(FooterThemeProviderInterface::class); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get the hook drop down theme provider. |
73
|
|
|
* |
74
|
|
|
* @return HookDropDownThemeProviderInterface Returns the hook drop down theme provider. |
75
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
76
|
|
|
*/ |
77
|
|
|
public function getHookDropDownThemeProvider() { |
78
|
|
|
return $this->getProvider(HookDropDownThemeProviderInterface::class); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Get the navigation theme provider. |
83
|
|
|
* |
84
|
|
|
* @return NavigationThemeProviderInterface Returns the navigation theme provider. |
85
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
86
|
|
|
*/ |
87
|
|
|
public function getNavigationThemeProvider() { |
88
|
|
|
return $this->getProvider(NavigationThemeProviderInterface::class); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Get the notifications drop down theme provider. |
93
|
|
|
* |
94
|
|
|
* @return NotificationsDropDownThemeProviderInterface Returns the Notifications drop down theme provider. |
95
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
96
|
|
|
*/ |
97
|
|
|
public function getNotificationsDropDownThemeProvider() { |
98
|
|
|
return $this->getProvider(NotificationsDropDownThemeProviderInterface::class); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Get the search theme provider. |
103
|
|
|
* |
104
|
|
|
* @return SearchThemeProviderInterface Returns the search theme provider. |
105
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
106
|
|
|
*/ |
107
|
|
|
public function getSearchThemeProvider() { |
108
|
|
|
return $this->getProvider(SearchThemeProviderInterface::class); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Get the tasks drop down theme provider. |
113
|
|
|
* |
114
|
|
|
* @return TasksDropDownThemeProviderInterface Returns the tasks drop down theme provider. |
115
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
116
|
|
|
*/ |
117
|
|
|
public function getTasksDropDownThemeProvider() { |
118
|
|
|
return $this->getProvider(TasksDropDownThemeProviderInterface::class); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Get the user info theme provider. |
123
|
|
|
* |
124
|
|
|
* @return UserInfoThemeProviderInterface Returns the user info theme provider. |
125
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
126
|
|
|
*/ |
127
|
|
|
public function getUserInfoThemeProvider() { |
128
|
|
|
return $this->getProvider(UserInfoThemeProviderInterface::class); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* {@inheritDoc} |
133
|
|
|
*/ |
134
|
|
|
protected function initIndex() { |
135
|
|
|
return [ |
136
|
|
|
ObjectHelper::getShortName(ApplicationThemeProviderInterface::class) => null, |
137
|
|
|
ObjectHelper::getShortName(BreadcrumbsThemeProviderInterface::class) => null, |
138
|
|
|
ObjectHelper::getShortName(FooterThemeProviderInterface::class) => null, |
139
|
|
|
ObjectHelper::getShortName(HookDropDownThemeProviderInterface::class) => null, |
140
|
|
|
ObjectHelper::getShortName(NavigationThemeProviderInterface::class) => null, |
141
|
|
|
ObjectHelper::getShortName(NotificationsDropDownThemeProviderInterface::class) => null, |
142
|
|
|
ObjectHelper::getShortName(SearchThemeProviderInterface::class) => null, |
143
|
|
|
ObjectHelper::getShortName(TasksDropDownThemeProviderInterface::class) => null, |
144
|
|
|
ObjectHelper::getShortName(UserInfoThemeProviderInterface::class) => null, |
145
|
|
|
]; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Set the application theme provider. |
150
|
|
|
* |
151
|
|
|
* @param ApplicationThemeProviderInterface $provider The application theme provider. |
152
|
|
|
* @return ManagerInterface Returns this manager. |
153
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
154
|
|
|
*/ |
155
|
|
|
public function setApplicationThemeProvider(ApplicationThemeProviderInterface $provider) { |
156
|
|
|
$this->setProvider(ApplicationThemeProviderInterface::class, $provider); |
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Set the breadcrumbs theme provider. |
162
|
|
|
* |
163
|
|
|
* @param BreadcrumbsThemeProviderInterface $provider The breadcrumbs theme provider. |
164
|
|
|
* @return ManagerInterface Returns this manager. |
165
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
166
|
|
|
*/ |
167
|
|
|
public function setBreadcrumbsThemeProvider(BreadcrumbsThemeProviderInterface $provider) { |
168
|
|
|
$this->setProvider(BreadcrumbsThemeProviderInterface::class, $provider); |
169
|
|
|
return $this; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Set the footer theme provider. |
174
|
|
|
* |
175
|
|
|
* @param FooterThemeProviderInterface $provider The footer theme provider. |
176
|
|
|
* @return ManagerInterface Returns this manager. |
177
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
178
|
|
|
*/ |
179
|
|
|
public function setFooterThemeProvider(FooterThemeProviderInterface $provider) { |
180
|
|
|
$this->setProvider(FooterThemeProviderInterface::class, $provider); |
181
|
|
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Set the hook drop down theme provider. |
186
|
|
|
* |
187
|
|
|
* @param HookDropDownThemeProviderInterface $provider The hook drop down theme provider. |
188
|
|
|
* @return ManagerInterface Returns this manager. |
189
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
190
|
|
|
*/ |
191
|
|
|
public function setHookDropDownThemeProvider(HookDropDownThemeProviderInterface $provider) { |
192
|
|
|
$this->setProvider(HookDropDownThemeProviderInterface::class, $provider); |
193
|
|
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Set the navigation theme provider. |
198
|
|
|
* |
199
|
|
|
* @param NavigationThemeProviderInterface $provider The navigation theme provider. |
200
|
|
|
* @return ManagerInterface Returns this manager. |
201
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
202
|
|
|
*/ |
203
|
|
|
public function setNavigationThemeProvider(NavigationThemeProviderInterface $provider) { |
204
|
|
|
$this->setProvider(NavigationThemeProviderInterface::class, $provider); |
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Set the notifications drop down theme provider. |
210
|
|
|
* |
211
|
|
|
* @param NotificationsDropDownThemeProviderInterface $provider The notifications drop down theme provider. |
212
|
|
|
* @return ManagerInterface Returns this manager. |
213
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
214
|
|
|
*/ |
215
|
|
|
public function setNotificationsDropDownThemeProvider(NotificationsDropDownThemeProviderInterface $provider) { |
216
|
|
|
$this->setProvider(NotificationsDropDownThemeProviderInterface::class, $provider); |
217
|
|
|
return $this; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Set the search theme provider. |
222
|
|
|
* |
223
|
|
|
* @param SearchThemeProviderInterface $provider The search theme provider. |
224
|
|
|
* @return ManagerInterface Returns this manager. |
225
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
226
|
|
|
*/ |
227
|
|
|
public function setSearchThemeProvider(SearchThemeProviderInterface $provider) { |
228
|
|
|
$this->setProvider(SearchThemeProviderInterface::class, $provider); |
229
|
|
|
return $this; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* Set the tasks drop down theme provider. |
234
|
|
|
* |
235
|
|
|
* @param TasksDropDownThemeProviderInterface $provider The tasks drop down theme provider. |
236
|
|
|
* @return ManagerInterface Returns this manager. |
237
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
238
|
|
|
*/ |
239
|
|
|
public function setTasksDropDownThemeProvider(TasksDropDownThemeProviderInterface $provider) { |
240
|
|
|
$this->setProvider(TasksDropDownThemeProviderInterface::class, $provider); |
241
|
|
|
return $this; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Set the user info theme provider. |
246
|
|
|
* |
247
|
|
|
* @param UserInfoThemeProviderInterface $provider The user info theme provider. |
248
|
|
|
* @return ManagerInterface Returns this manager. |
249
|
|
|
* @throws ReflectionException Throws a reflection exception if an error occurs. |
250
|
|
|
*/ |
251
|
|
|
public function setUserInfoThemeProvider(UserInfoThemeProviderInterface $provider) { |
252
|
|
|
$this->setProvider(UserInfoThemeProviderInterface::class, $provider); |
253
|
|
|
return $this; |
254
|
|
|
} |
255
|
|
|
} |
256
|
|
|
|