-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpushy.php
More file actions
130 lines (113 loc) · 2.58 KB
/
Copy pathpushy.php
File metadata and controls
130 lines (113 loc) · 2.58 KB
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
129
130
<?php
/**
* @package Joomla.Site
* @subpackage mod_menu
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Note. It is important to remove spaces between elements.
// $class_sfx
?>
<ul class="pushy-main-submenu no-bullet"<?php
$tag = '';
if ($params->get('tag_id') != null)
{
$tag = $params->get('tag_id') . '';
echo ' id="' . $tag . '"';
}
?>>
<?php
// Uncomment to place a link to the home page in the offcanvas menu
// echo '<li><a href="'.JUri::base().'">Home</a></li>';
foreach ($list as $i => &$item)
{
$class = 'item-' . $item->id;
if (($item->id == $active_id) OR ($item->type == 'alias' AND $item->params->get('aliasoptions') == $active_id))
{
$class .= ' current';
}
if (in_array($item->id, $path))
{
$class .= ' active';
}
elseif ($item->type == 'alias')
{
$aliasToId = $item->params->get('aliasoptions');
if (count($path) > 0 && $aliasToId == $path[count($path) - 1])
{
$class .= ' active';
}
elseif (in_array($aliasToId, $path))
{
$class .= ' alias-parent-active';
}
}
if ($item->type == 'separator')
{
$class .= ' divider';
}
if ($item->deeper)
{
$class .= ' deeper';
}
if ($item->parent)
{
$class .= ' parent';
}
if (!empty($class))
{
$class = ' class="' . trim($class) . '"';
}
echo '<li' . $class . '>';
// Render the menu item.
renderItem($item->type, $item, $params);
// The next item is deeper.
if ($item->deeper)
{
echo '<ul class="pushy-submenu no-bullet">';
// Render the parent menu item.
echo '<li' . $class . '>';
// Reset $item->deeper so we don't get a chevron on the submenu
$item->deeper = 0;
renderItem($item->type, $item, $params);
echo '</li>';
// End parent menu item
}
elseif ($item->shallower)
{
// The next item is shallower.
echo '</li>';
echo '<li class="pushy-close-submenu"><a>Main Menu</a></li>';
echo str_repeat('</ul></li>', $item->level_diff);
}
else
{
// The next item is on the same level.
echo '</li>';
}
}
?>
</ul>
<?php
/**
* Method for rendering a menu item
*
* @param string item_type The menu item's type property
* @param object item The item object itself
*/
function renderItem($item_type, $item, $params)
{
switch ($item_type) :
case 'separator':
case 'url':
case 'component':
case 'heading':
require JModuleHelper::getLayoutPath('mod_menu', 'pushy_' . $item_type);
break;
default:
require JModuleHelper::getLayoutPath('mod_menu', 'pushy_url');
break;
endswitch;
}