-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuilder.menu.php
128 lines (119 loc) · 3.7 KB
/
builder.menu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
$action = $modx->newObject('modAction');
$action->fromArray(array(
'id' => 1,
'namespace' => 'visioncart',
'parent' => 0,
'controller' => 'index',
'haslayout' => 1,
'lang_topics' => 'visioncart:default',
'assets' => ''
), '', true, true);
// The main menu item
$menu = $modx->newObject('modMenu');
$menu->fromArray(array(
'text' => 'menu.visioncart',
'parent' => 'components',
'description' => 'menu.visioncart_desc',
'icon' => '',
'menuindex' => '0',
'params' => '',
'handler' => ''
), '', true, true);
$menu->addOne($action);
$vehicle = $builder->createVehicle($menu, array (
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'text',
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
'Action' => array (
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => array ('namespace','controller'),
)
)
));
$builder->putVehicle($vehicle);
unset($menu, $vehicle);
// Create shops submenu
$menu = $modx->newObject('modMenu');
$menu->fromArray(array(
'text' => 'menu.visioncart_shopmanagement',
'parent' => 'menu.visioncart',
'description' => 'menu.visioncart_shopmanagement_desc',
'icon' => '',
'menuindex' => '0',
'params' => '',
'handler' => ''
), '', true, true);
$menu->addOne($action);
$vehicle = $builder->createVehicle($menu, array (
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'text',
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
'Action' => array (
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => array ('namespace','controller'),
)
)
));
$builder->putVehicle($vehicle);
unset($menu, $vehicle);
// Module management
$menu = $modx->newObject('modMenu');
$menu->fromArray(array(
'text' => 'menu.visioncart_modules',
'parent' => 'menu.visioncart',
'description' => 'menu.visioncart_modules_desc',
'icon' => '',
'menuindex' => '1',
'params' => '&action=modules',
'handler' => ''
), '', true, true);
$menu->addOne($action);
$vehicle = $builder->createVehicle($menu, array (
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'text',
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
'Action' => array (
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => array ('namespace','controller'),
)
)
));
$builder->putVehicle($vehicle);
unset($menu, $vehicle);
// The second main menu item
$menu = $modx->newObject('modMenu');
$menu->fromArray(array(
'text' => 'menu.visioncart_shops',
'parent' => 'components',
'description' => 'menu.visioncart_shops_desc',
'icon' => '',
'menuindex' => '0',
'params' => '',
'handler' => ''
), '', true, true);
$menu->addOne($action);
$vehicle = $builder->createVehicle($menu, array (
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => false,
xPDOTransport::UNIQUE_KEY => 'text',
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
'Action' => array (
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => false,
xPDOTransport::UNIQUE_KEY => array ('namespace','controller'),
)
)
));
$builder->putVehicle($vehicle);
unset($vehicle,$action); /* to keep memory low */