|
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\ShopBundle\Menu; |
|
13
|
|
|
|
|
14
|
|
|
use Knp\Menu\ItemInterface; |
|
15
|
|
|
use Sylius\Bundle\UiBundle\Menu\AbstractMenuBuilder; |
|
16
|
|
|
use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @author Paweł Jędrzejewski <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
final class AccountMenuBuilder extends AbstractMenuBuilder |
|
22
|
|
|
{ |
|
23
|
|
|
const EVENT_NAME = 'sylius.menu.shop.account'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @return ItemInterface |
|
27
|
|
|
*/ |
|
28
|
|
|
public function createMenu() |
|
29
|
|
|
{ |
|
30
|
|
|
$menu = $this->factory->createItem('root'); |
|
31
|
|
|
$menu->setLabel('sylius.menu.shop.account.header'); |
|
32
|
|
|
|
|
33
|
|
|
$menu |
|
34
|
|
|
->addChild('dashboard', ['route' => 'sylius_shop_account_dashboard']) |
|
35
|
|
|
->setLabel('sylius.menu.shop.account.dashboard') |
|
36
|
|
|
->setLabelAttribute('icon', 'home') |
|
37
|
|
|
; |
|
38
|
|
|
$menu |
|
39
|
|
|
->addChild('personal_information', ['route' => 'sylius_shop_account_profile_update']) |
|
40
|
|
|
->setLabel('sylius.menu.shop.account.personal_information') |
|
41
|
|
|
->setLabelAttribute('icon', 'user') |
|
42
|
|
|
; |
|
43
|
|
|
$menu |
|
44
|
|
|
->addChild('change_password', ['route' => 'sylius_shop_account_change_password']) |
|
45
|
|
|
->setLabel('sylius.menu.shop.account.change_password') |
|
46
|
|
|
->setLabelAttribute('icon', 'lock') |
|
47
|
|
|
; |
|
48
|
|
|
$menu |
|
49
|
|
|
->addChild('order_history', ['route' => 'sylius_shop_account_order_index']) |
|
50
|
|
|
->setLabel('sylius.menu.shop.account.order_history') |
|
51
|
|
|
->setLabelAttribute('icon', 'cart') |
|
52
|
|
|
; |
|
53
|
|
|
|
|
54
|
|
|
$this->eventDispatcher->dispatch(self::EVENT_NAME, new MenuBuilderEvent($this->factory, $menu)); |
|
55
|
|
|
|
|
56
|
|
|
return $menu; |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|