/
Builder.php
76 lines (64 loc) · 2.87 KB
/
Builder.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
<?php
namespace Mopa\Bundle\BootstrapSandboxBundle\Menu;
use Knp\Menu\FactoryInterface;
/**
* An example howto inject a default KnpMenu to the Navbar
* see also Resources/config/example_menu.yml
* and example_navbar.yml
* @author phiamo
*
*/
class Builder
{
public function createMainMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root', array(
'navbar' => true,
));
$layout = $menu->addChild('Layout', array(
'icon' => 'home',
'route' => 'mopa_bootstrap_layout_example',
));
$dropdown = $menu->addChild('Forms', array(
'dropdown' => true,
'caret' => true,
));
$dropdown->addChild('Examples', array('route' => 'mopa_bootstrap_forms_examples'));
$dropdown->addChild('Horizontal', array('route' => 'mopa_bootstrap_forms_horizontal'));
$dropdown->addChild('Extended Forms', array('route' => 'mopa_bootstrap_forms_extended'));
$dropdown->addChild('Extended Views', array('route' => 'mopa_bootstrap_forms_view_extended'));
$dropdown->addChild('Embedded Type Forms', array('route' => 'mopa_bootstrap_forms_embeddedtype'));
$dropdown->addChild('Forms Errors', array('route' => 'mopa_bootstrap_forms_errors'));
$dropdown->addChild('Help Texts', array('route' => 'mopa_bootstrap_forms_helptexts'));
$dropdown->addChild('Choice Fields', array('route' => 'mopa_bootstrap_forms_choices'));
$dropdown->addChild('Collections Fields', array('route' => 'mopa_bootstrap_forms_collections'));
$dropdown->addChild('Form Tabs', array('route' => 'mopa_bootstrap_forms_tabs'));
$menu->addChild('Menus & Navbars', array('route' => 'mopa_bootstrap_navbar'));
$menu->addChild('Macros for components', array('route' => 'mopa_bootstrap_components'));
return $menu;
}
public function createNavbarsSubnavMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root', array(
'subnavbar' => true,
));
$menu->addChild('Top', array('uri' => '#top'));
$menu->addChild('Menus', array('uri' => '#menus'));
$menu->addChild('Navbars', array('uri' => '#navbars'));
$menu->addChild('Template', array('uri' => '#template'));
// ... add more children
return $menu;
}
public function createComponentsSubnavMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root', array(
'subnavbar' => true,
));
$menu->addChild('Top', array('uri' => '#top'));
$menu->addChild('Flashs', array('uri' => '#flashs'));
$menu->addChild('Session Flashs', array('uri' => '#session-flashes'));
$menu->addChild('Labels & Badges', array('uri' => '#labels-badges'));
// ... add more children
return $menu;
}
}