1
1
<?php
2
- use_helper ('I18N ' );
3
- /** @var Array of menu items */ $ items = $ sf_data ->getRaw ('items ' );
4
- /** @var Array of categories, each containing an array of menu items and settings */ $ categories = $ sf_data ->getRaw ('categories ' );
2
+ use_helper ('I18N ' );
3
+ /** @var Array of menu items */ $ items = $ sf_data ->getRaw ('items ' );
4
+ /** @var Array of categories, each containing an array of menu items and settings */ $ categories = $ sf_data ->getRaw ('categories ' );
5
5
?>
6
6
7
7
8
8
<?php if (count ($ items )): ?>
9
9
<ul class="nav">
10
10
<?php if (sfTwitterBootstrap::hasItemsMenu ($ items )): ?>
11
- <li class="dropdown" data-dropdown="dropdown"><a href="#" class="dropdown-toggle" >Menu</a>
12
- <ul class="dropdown-menu">
13
- <?php include_partial ('sfTwitterBootstrap/menu_list ' , array ('items ' => $ items , 'items_in_menu ' => true )); ?>
14
- </ul>
15
- </li>
16
- <?php endif ; ?>
11
+ <li class="dropdown" data-dropdown="dropdown"><a href="#" class="dropdown-toggle" >Menu</a>
12
+ <ul class="dropdown-menu">
13
+ <?php include_partial ('sfTwitterBootstrap/menu_list ' , array ('items ' => $ items , 'items_in_menu ' => true )); ?>
14
+ </ul>
15
+ </li>
16
+ <?php endif ; ?>
17
17
<?php include_partial ('sfTwitterBootstrap/menu_list ' , array ('items ' => $ items , 'items_in_menu ' => false )); ?>
18
18
</ul>
19
19
<?php endif ; ?>
20
+
20
21
<?php if (count ($ categories )): ?>
21
22
<ul class="nav">
23
+
22
24
<?php foreach ($ categories as $ name => $ category ): ?>
23
- <?php if (sfTwitterBootstrap::hasPermission ($ category , $ sf_user )): ?>
24
- <?php if (sfTwitterBootstrap::hasItemsMenu ($ category ['items ' ])): ?>
25
- <li class="dropdown"><a href="#" class="dropdown-toggle" ><?php echo __ (isset ($ category ['name ' ]) ? $ category ['name ' ] : $ name ) ?> </a>
26
- <ul class="dropdown-menu">
27
- <?php include_partial ('sfTwitterBootstrap/menu_list ' , array ('items ' => $ category ['items ' ], 'items_in_menu ' => true )) ?>
28
- </ul>
29
- </li>
30
- <?php endif ; ?>
31
- <?php endif ; ?>
25
+ <?php if (sfTwitterBootstrap::hasPermission ($ category , $ sf_user )): ?>
26
+ <li class="dropdown">
27
+
28
+ <?php if (isset ($ category ['url ' ])): ?>
29
+
30
+ <?php $ class = '' ; ?>
31
+ <?php if (isset ($ category ['items ' ])): ?>
32
+ <?php if (sfTwitterBootstrap::hasItemsMenu ($ category ['items ' ])): ?>
33
+ <?php $ class = 'dropdown-toggle ' ; ?>
34
+ <?php endif ; ?>
35
+ <?php endif ; ?>
36
+
37
+ <a href="<?php echo url_for ($ category ['url ' ]); ?> " class="<?php echo $ class ; ?> " ><?php echo __ (isset ($ category ['name ' ]) ? $ category ['name ' ] : $ name ) ?> </a>
38
+
39
+ <?php else : ?>
40
+ <a href="#" class="dropdown-toggle" ><?php echo __ (isset ($ category ['name ' ]) ? $ category ['name ' ] : $ name ) ?> </a>
41
+ <?php endif ; ?>
42
+
43
+ <?php if (isset ($ category ['items ' ]) && sfTwitterBootstrap::hasItemsMenu ($ category ['items ' ])): ?>
44
+ <ul class="dropdown-menu">
45
+ <?php include_partial ('sfTwitterBootstrap/menu_list ' , array ('items ' => $ category ['items ' ], 'items_in_menu ' => true )) ?>
46
+ </ul>
47
+ <?php endif ; ?>
48
+ </li>
49
+ <?php endif ; ?>
32
50
<?php endforeach ; ?>
51
+
33
52
<?php foreach ($ categories as $ name => $ category ): ?>
53
+ <?php if (isset ($ category ['items ' ])): ?>
34
54
<?php include_partial ('sfTwitterBootstrap/menu_list ' , array ('items ' => $ category ['items ' ], 'items_in_menu ' => false )) ?>
55
+ <?php endif ; ?>
35
56
<?php endforeach ; ?>
57
+
36
58
</ul>
37
59
<?php elseif (!count ($ items )): ?>
38
60
<?php echo __ ('sfTwitterBootstrap is not configured. ' ); ?>
39
- <?php endif ; ?>
61
+ <?php endif ; ?>
0 commit comments