1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sylius package. |
5
|
|
|
* |
6
|
|
|
* (c) Paweł Jędrzejewski |
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 Sylius\Bundle\WebBundle\Menu; |
13
|
|
|
|
14
|
|
|
use Knp\Menu\ItemInterface; |
15
|
|
|
use Sylius\Bundle\WebBundle\Event\MenuBuilderEvent; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Main menu builder. |
19
|
|
|
* |
20
|
|
|
* @author Paweł Jędrzejewski <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
class BackendMenuBuilder extends MenuBuilder |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Builds backend main menu. |
26
|
|
|
* |
27
|
|
|
* @return ItemInterface |
28
|
|
|
*/ |
29
|
|
|
public function createMainMenu() |
30
|
|
|
{ |
31
|
|
|
$menu = $this->factory->createItem('root', array( |
32
|
|
|
'childrenAttributes' => array( |
33
|
|
|
'class' => 'nav navbar-nav navbar-right' |
34
|
|
|
) |
35
|
|
|
)); |
36
|
|
|
|
37
|
|
|
$childOptions = array( |
38
|
|
|
'attributes' => array('class' => 'dropdown'), |
39
|
|
|
'childrenAttributes' => array('class' => 'dropdown-menu'), |
40
|
|
|
'labelAttributes' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'href' => '#') |
41
|
|
|
); |
42
|
|
|
|
43
|
|
|
$menu->addChild('dashboard', array( |
44
|
|
|
'route' => 'sylius_backend_dashboard' |
45
|
|
|
))->setLabel($this->translate('sylius.backend.menu.main.dashboard')); |
46
|
|
|
|
47
|
|
|
$this->addAssortmentMenu($menu, $childOptions, 'main'); |
48
|
|
|
$this->addSalesMenu($menu, $childOptions, 'main'); |
49
|
|
|
$this->addCustomerMenu($menu, $childOptions, 'main'); |
50
|
|
|
$this->addMarketingMenu($menu, $childOptions, 'main'); |
51
|
|
|
$this->addSupportMenu($menu, $childOptions, 'main'); |
52
|
|
|
$this->addContentMenu($menu, $childOptions, 'main'); |
53
|
|
|
$this->addConfigurationMenu($menu, $childOptions, 'main'); |
54
|
|
|
|
55
|
|
|
$menu->addChild('homepage', array( |
56
|
|
|
'route' => 'sylius_homepage' |
57
|
|
|
))->setLabel($this->translate('sylius.backend.menu.main.homepage')); |
58
|
|
|
|
59
|
|
|
$menu->addChild('logout', array( |
60
|
|
|
'route' => 'sylius_user_security_logout' |
61
|
|
|
))->setLabel($this->translate('sylius.backend.logout')); |
62
|
|
|
|
63
|
|
|
$this->eventDispatcher->dispatch(MenuBuilderEvent::BACKEND_MAIN, new MenuBuilderEvent($this->factory, $menu)); |
64
|
|
|
|
65
|
|
|
return $menu; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Builds backend sidebar menu. |
70
|
|
|
* |
71
|
|
|
* @return ItemInterface |
72
|
|
|
*/ |
73
|
|
|
public function createSidebarMenu() |
74
|
|
|
{ |
75
|
|
|
$menu = $this->factory->createItem('root', array( |
76
|
|
|
'childrenAttributes' => array( |
77
|
|
|
'class' => 'nav' |
78
|
|
|
) |
79
|
|
|
)); |
80
|
|
|
|
81
|
|
|
$menu->setCurrentUri($this->request->getRequestUri()); |
82
|
|
|
|
83
|
|
|
$childOptions = array( |
84
|
|
|
'childrenAttributes' => array('class' => 'nav'), |
85
|
|
|
'labelAttributes' => array('class' => 'nav-header') |
86
|
|
|
); |
87
|
|
|
|
88
|
|
|
$this->addAssortmentMenu($menu, $childOptions, 'sidebar'); |
89
|
|
|
$this->addSalesMenu($menu, $childOptions, 'sidebar'); |
90
|
|
|
$this->addMarketingMenu($menu, $childOptions, 'sidebar'); |
91
|
|
|
$this->addCustomerMenu($menu, $childOptions, 'sidebar'); |
92
|
|
|
$this->addSupportMenu($menu, $childOptions, 'sidebar'); |
93
|
|
|
$this->addContentMenu($menu, $childOptions, 'sidebar'); |
94
|
|
|
$this->addConfigurationMenu($menu, $childOptions, 'sidebar'); |
95
|
|
|
|
96
|
|
|
$this->eventDispatcher->dispatch(MenuBuilderEvent::BACKEND_SIDEBAR, new MenuBuilderEvent($this->factory, $menu)); |
97
|
|
|
|
98
|
|
|
return $menu; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Add assortment menu. |
103
|
|
|
* |
104
|
|
|
* @param ItemInterface $menu |
105
|
|
|
* @param array $childOptions |
106
|
|
|
* @param string $section |
107
|
|
|
*/ |
108
|
|
|
protected function addAssortmentMenu(ItemInterface $menu, array $childOptions, $section) |
109
|
|
|
{ |
110
|
|
|
$child = $menu |
111
|
|
|
->addChild('assortment', $childOptions) |
112
|
|
|
->setLabel($this->translate(sprintf('sylius.backend.menu.%s.assortment', $section))) |
113
|
|
|
; |
114
|
|
|
|
115
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.taxonomy.index')) { |
116
|
|
|
$child->addChild('taxonomies', array( |
117
|
|
|
'route' => 'sylius_backend_taxonomy_index', |
118
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-folder-close'), |
119
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.taxonomies', $section))); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.product.index')) { |
123
|
|
|
$child->addChild('products', array( |
124
|
|
|
'route' => 'sylius_backend_product_index', |
125
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-th-list'), |
126
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.products', $section))); |
127
|
|
|
$child->addChild('inventory', array( |
128
|
|
|
'route' => 'sylius_backend_inventory_index', |
129
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-tasks'), |
130
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.stockables', $section))); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.product_option.index')) { |
134
|
|
|
$child->addChild('options', array( |
135
|
|
|
'route' => 'sylius_backend_product_option_index', |
136
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-th'), |
137
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.options', $section))); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.product_attribute.index')) { |
141
|
|
|
$child->addChild('product_attributes', array( |
142
|
|
|
'route' => 'sylius_backend_product_attribute_index', |
143
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-list-alt'), |
144
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.attributes', $section))); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.product_archetype.index')) { |
148
|
|
|
$child->addChild('product_archetypes', array( |
149
|
|
|
'route' => 'sylius_backend_product_archetype_index', |
150
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-compressed'), |
151
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.archetypes', $section))); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
if (!$child->hasChildren()) { |
155
|
|
|
$menu->removeChild('assortment'); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
$child->addChild('product_association types', array( |
159
|
|
|
'route' => 'sylius_backend_product_association_type_index', |
160
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-th-list'), |
161
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.association_types', $section))); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Add content menu. |
166
|
|
|
* |
167
|
|
|
* @param ItemInterface $menu |
168
|
|
|
* @param array $childOptions |
169
|
|
|
* @param string $section |
170
|
|
|
*/ |
171
|
|
|
protected function addContentMenu(ItemInterface $menu, array $childOptions, $section) |
172
|
|
|
{ |
173
|
|
|
$child = $menu |
174
|
|
|
->addChild('content', $childOptions) |
175
|
|
|
->setLabel($this->translate(sprintf('sylius.backend.menu.%s.content', $section))) |
176
|
|
|
; |
177
|
|
|
|
178
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.simple_block.index')) { |
179
|
|
|
$child->addChild('blocks', array( |
180
|
|
|
'route' => 'sylius_backend_block_overview', |
181
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-th-large'), |
182
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.blocks', $section))); |
183
|
|
|
} |
184
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.static_content.index')) { |
185
|
|
|
$child->addChild('Pages', array( |
186
|
|
|
'route' => 'sylius_backend_static_content_index', |
187
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-file'), |
188
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.pages', $section))); |
189
|
|
|
} |
190
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.menu.index')) { |
191
|
|
|
$child->addChild('Menus', array( |
192
|
|
|
'route' => 'sylius_backend_menu_index', |
193
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-list-alt'), |
194
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.menus', $section))); |
195
|
|
|
} |
196
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.slideshow.index')) { |
197
|
|
|
$child->addChild('Slideshow', array( |
198
|
|
|
'route' => 'sylius_backend_slideshow_block_index', |
199
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-film'), |
200
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.slideshow', $section))); |
201
|
|
|
} |
202
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.route.index')) { |
203
|
|
|
$child->addChild('Routes', array( |
204
|
|
|
'route' => 'sylius_backend_route_index', |
205
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-random'), |
206
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.routes', $section))); |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
if (!$child->hasChildren()) { |
210
|
|
|
$menu->removeChild('content'); |
211
|
|
|
} |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Add marketing menu. |
216
|
|
|
* |
217
|
|
|
* @param ItemInterface $menu |
218
|
|
|
* @param array $childOptions |
219
|
|
|
* @param string $section |
220
|
|
|
*/ |
221
|
|
|
protected function addMarketingMenu(ItemInterface $menu, array $childOptions, $section) |
222
|
|
|
{ |
223
|
|
|
$child = $menu |
224
|
|
|
->addChild('marketing', $childOptions) |
225
|
|
|
->setLabel($this->translate(sprintf('sylius.backend.menu.%s.marketing', $section))) |
226
|
|
|
; |
227
|
|
|
|
228
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.promotion.index')) { |
229
|
|
|
$child->addChild('promotions', array( |
230
|
|
|
'route' => 'sylius_backend_promotion_index', |
231
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-bullhorn'), |
232
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.promotions', $section))); |
233
|
|
|
} |
234
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.promotion.create')) { |
235
|
|
|
$child->addChild('new_promotion', array( |
236
|
|
|
'route' => 'sylius_backend_promotion_create', |
237
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-plus-sign'), |
238
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.new_promotion', $section))); |
239
|
|
|
} |
240
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.manage.email')) { |
241
|
|
|
$child->addChild('emails', array( |
242
|
|
|
'route' => 'sylius_backend_email_index', |
243
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-envelope'), |
244
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.emails', $section))); |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
if (!$child->hasChildren()) { |
248
|
|
|
$menu->removeChild('marketing'); |
249
|
|
|
} |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* Add support menu. |
254
|
|
|
* |
255
|
|
|
* @param ItemInterface $menu |
256
|
|
|
* @param array $childOptions |
257
|
|
|
* @param string $section |
258
|
|
|
*/ |
259
|
|
|
protected function addSupportMenu(ItemInterface $menu, array $childOptions, $section) |
260
|
|
|
{ |
261
|
|
|
$child = $menu |
262
|
|
|
->addChild('support', $childOptions) |
263
|
|
|
->setLabel($this->translate(sprintf('sylius.backend.menu.%s.support', $section))) |
264
|
|
|
; |
265
|
|
|
|
266
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.contact_request.index')) { |
267
|
|
|
$child->addChild('contact_requests', array( |
268
|
|
|
'route' => 'sylius_backend_contact_request_index', |
269
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-envelope'), |
270
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.contact_requests', $section))); |
271
|
|
|
} |
272
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.contact_topic.index')) { |
273
|
|
|
$child->addChild('contact_topics', array( |
274
|
|
|
'route' => 'sylius_backend_contact_topic_index', |
275
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-align-justify'), |
276
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.contact_topics', $section))); |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
if (!$child->hasChildren()) { |
280
|
|
|
$menu->removeChild('support'); |
281
|
|
|
} |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* Add customers menu. |
286
|
|
|
* |
287
|
|
|
* @param ItemInterface $menu |
288
|
|
|
* @param array $childOptions |
289
|
|
|
* @param string $section |
290
|
|
|
*/ |
291
|
|
|
protected function addCustomerMenu(ItemInterface $menu, array $childOptions, $section) |
292
|
|
|
{ |
293
|
|
|
$child = $menu |
294
|
|
|
->addChild('customer', $childOptions) |
295
|
|
|
->setLabel($this->translate(sprintf('sylius.backend.menu.%s.customer', $section))) |
296
|
|
|
; |
297
|
|
|
|
298
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.customer.index')) { |
299
|
|
|
$child->addChild('customers', array( |
300
|
|
|
'route' => 'sylius_backend_customer_index', |
301
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-user'), |
302
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.customers', $section))); |
303
|
|
|
} |
304
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.group.index')) { |
305
|
|
|
$child->addChild('groups', array( |
306
|
|
|
'route' => 'sylius_backend_group_index', |
307
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-home'), |
308
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.groups', $section))); |
309
|
|
|
} |
310
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.role.index')) { |
311
|
|
|
$child->addChild('roles', array( |
312
|
|
|
'route' => 'sylius_backend_role_index', |
313
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-sort-by-attributes'), |
314
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.roles', $section))); |
315
|
|
|
} |
316
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.permission.index')) { |
317
|
|
|
$child->addChild('permissions', array( |
318
|
|
|
'route' => 'sylius_backend_permission_index', |
319
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-lock'), |
320
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.permissions', $section))); |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
if (!$child->hasChildren()) { |
324
|
|
|
$menu->removeChild('customer'); |
325
|
|
|
} |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* Add sales menu. |
330
|
|
|
* |
331
|
|
|
* @param ItemInterface $menu |
332
|
|
|
* @param array $childOptions |
333
|
|
|
* @param string $section |
334
|
|
|
*/ |
335
|
|
|
protected function addSalesMenu(ItemInterface $menu, array $childOptions, $section) |
336
|
|
|
{ |
337
|
|
|
$child = $menu |
338
|
|
|
->addChild('sales', $childOptions) |
339
|
|
|
->setLabel($this->translate(sprintf('sylius.backend.menu.%s.sales', $section))) |
340
|
|
|
; |
341
|
|
|
|
342
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.order.index')) { |
343
|
|
|
$child->addChild('orders', array( |
344
|
|
|
'route' => 'sylius_backend_order_index', |
345
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-shopping-cart'), |
346
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.orders', $section))); |
347
|
|
|
} |
348
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.shipment.index')) { |
349
|
|
|
$child->addChild('shipments', array( |
350
|
|
|
'route' => 'sylius_backend_shipment_index', |
351
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-plane'), |
352
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.shipments', $section))); |
353
|
|
|
} |
354
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.payment.index')) { |
355
|
|
|
$child->addChild('payments', array( |
356
|
|
|
'route' => 'sylius_backend_payment_index', |
357
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-credit-card'), |
358
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.payments', $section))); |
359
|
|
|
} |
360
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.report.index')) { |
361
|
|
|
$child->addChild('reports', array( |
362
|
|
|
'route' => 'sylius_backend_report_index', |
363
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-stats'), |
364
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.report', $section))); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
if (!$child->hasChildren()) { |
368
|
|
|
$menu->removeChild('sales'); |
369
|
|
|
} |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* Add configuration menu. |
374
|
|
|
* |
375
|
|
|
* @param ItemInterface $menu |
376
|
|
|
* @param array $childOptions |
377
|
|
|
* @param string $section |
378
|
|
|
*/ |
379
|
|
|
protected function addConfigurationMenu(ItemInterface $menu, array $childOptions, $section) |
380
|
|
|
{ |
381
|
|
|
$child = $menu |
382
|
|
|
->addChild('configuration', $childOptions) |
383
|
|
|
->setLabel($this->translate(sprintf('sylius.backend.menu.%s.configuration', $section))) |
384
|
|
|
; |
385
|
|
|
|
386
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.settings.sylius_general')) { |
387
|
|
|
$child->addChild('general_settings', array( |
388
|
|
|
'route' => 'sylius_backend_general_settings', |
389
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-info-sign'), |
390
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.general_settings', $section))); |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.settings.sylius_security')) { |
394
|
|
|
$child->addChild('security_settings', array( |
395
|
|
|
'route' => 'sylius_backend_security_settings', |
396
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-lock'), |
397
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.security_settings', $section))); |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.channel.index')) { |
401
|
|
|
$child->addChild('channels', array( |
402
|
|
|
'route' => 'sylius_backend_channel_index', |
403
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog'), |
404
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.channels', $section))); |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.metadata_container.index')) { |
408
|
|
|
$child->addChild('metadata', array( |
409
|
|
|
'route' => 'sylius_backend_metadata_container_index', |
410
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-file'), |
411
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.metadata', $section))); |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.locale.index')) { |
415
|
|
|
$child->addChild('locales', array( |
416
|
|
|
'route' => 'sylius_backend_locale_index', |
417
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-flag'), |
418
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.locales', $section))); |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.payment_method.index')) { |
422
|
|
|
$child->addChild('payment_methods', array( |
423
|
|
|
'route' => 'sylius_backend_payment_method_index', |
424
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-credit-card'), |
425
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.payment_methods', $section))); |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.currency.index')) { |
429
|
|
|
$child->addChild('currencies', array( |
430
|
|
|
'route' => 'sylius_backend_currency_index', |
431
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-usd'), |
432
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.currencies', $section))); |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.settings.sylius_taxation')) { |
436
|
|
|
$child->addChild('taxation_settings', array( |
437
|
|
|
'route' => 'sylius_backend_taxation_settings', |
438
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog'), |
439
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.taxation_settings', $section))); |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.tax_category.index')) { |
443
|
|
|
$child->addChild('tax_categories', array( |
444
|
|
|
'route' => 'sylius_backend_tax_category_index', |
445
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog'), |
446
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.tax_categories', $section))); |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.tax_rate.index')) { |
450
|
|
|
$child->addChild('tax_rates', array( |
451
|
|
|
'route' => 'sylius_backend_tax_rate_index', |
452
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog'), |
453
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.tax_rates', $section))); |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.shipping_category.index')) { |
457
|
|
|
$child->addChild('shipping_categories', array( |
458
|
|
|
'route' => 'sylius_backend_shipping_category_index', |
459
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog'), |
460
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.shipping_categories', $section))); |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.shipping_method.index')) { |
464
|
|
|
$child->addChild('shipping_methods', array( |
465
|
|
|
'route' => 'sylius_backend_shipping_method_index', |
466
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-cog'), |
467
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.shipping_methods', $section))); |
468
|
|
|
} |
469
|
|
|
|
470
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.country.index')) { |
471
|
|
|
$child->addChild('countries', array( |
472
|
|
|
'route' => 'sylius_backend_country_index', |
473
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-flag'), |
474
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.countries', $section))); |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.zone.index')) { |
478
|
|
|
$child->addChild('zones', array( |
479
|
|
|
'route' => 'sylius_backend_zone_index', |
480
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-globe'), |
481
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.zones', $section))); |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
if ($this->rbacAuthorizationChecker->isGranted('sylius.api_client.index')) { |
485
|
|
|
$child->addChild('api_clients', array( |
486
|
|
|
'route' => 'sylius_backend_api_client_index', |
487
|
|
|
'labelAttributes' => array('icon' => 'glyphicon glyphicon-globe'), |
488
|
|
|
))->setLabel($this->translate(sprintf('sylius.backend.menu.%s.api_clients', $section))); |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
if (!$child->hasChildren()) { |
492
|
|
|
$menu->removeChild('configuration'); |
493
|
|
|
} |
494
|
|
|
} |
495
|
|
|
} |
496
|
|
|
|