|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Cortex\Auth\Presenters; |
|
6
|
|
|
|
|
7
|
|
|
use Rinvex\Menus\Models\MenuItem; |
|
8
|
|
|
use Rinvex\Menus\Presenters\BasePresenter; |
|
9
|
|
|
|
|
10
|
|
|
class AccountSidebarMenuPresenter extends BasePresenter |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* Get open tag wrapper. |
|
14
|
|
|
* |
|
15
|
|
|
* @return string |
|
16
|
|
|
*/ |
|
17
|
|
|
public function getOpenTagWrapper(): string |
|
18
|
|
|
{ |
|
19
|
|
|
return '<ul class="nav">'; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Get close tag wrapper. |
|
24
|
|
|
* |
|
25
|
|
|
* @return string |
|
26
|
|
|
*/ |
|
27
|
|
|
public function getCloseTagWrapper(): string |
|
28
|
|
|
{ |
|
29
|
|
|
return '</ul>'; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* {@inheritdoc} |
|
34
|
|
|
*/ |
|
35
|
|
|
public function getDividerWrapper(): string |
|
36
|
|
|
{ |
|
37
|
|
|
return '<li class="divider"></li>'; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* {@inheritdoc} |
|
42
|
|
|
*/ |
|
43
|
|
|
public function getHeaderWrapper(MenuItem $item): string |
|
44
|
|
|
{ |
|
45
|
|
|
return '<li class="dropdown-header">'.($item->icon ? '<i class="'.$item->icon.'"></i> ' : '').$item->title.'</li>'; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get menu tag without dropdown wrapper. |
|
50
|
|
|
* |
|
51
|
|
|
* @param \Rinvex\Menus\Models\MenuItem $item |
|
52
|
|
|
* |
|
53
|
|
|
* @return string |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getMenuWithoutDropdownWrapper(MenuItem $item): string |
|
56
|
|
|
{ |
|
57
|
|
|
return '<li class="'.($item->isActive() ? 'active' : '').'"> |
|
58
|
|
|
<a href="'.$item->getUrl().'" '.$item->getAttributes().'> |
|
59
|
|
|
'.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').' |
|
60
|
|
|
'.$item->title.' |
|
61
|
|
|
</a> |
|
62
|
|
|
</li>'; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* {@inheritdoc} |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getMenuWithDropDownWrapper(MenuItem $item, bool $specialSidebar = false): string |
|
69
|
|
|
{ |
|
70
|
|
|
$id = str_random(); |
|
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
return $specialSidebar |
|
73
|
|
|
? $this->getHeaderWrapper($item).$this->getChildMenuItems($item) |
|
74
|
|
|
: '<li class="panel panel-default'.($item->hasActiveOnChild() ? ' active' : '').'" id="dropdown"> |
|
75
|
|
|
<a data-toggle="collapse" href="#'.$id.'"> |
|
76
|
|
|
'.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').' |
|
77
|
|
|
'.$item->title.' <span class="caret"></span> |
|
78
|
|
|
</a> |
|
79
|
|
|
<div id="'.$id.'" class="panel-collapse collapse'.($item->hasActiveOnChild() ? ' in' : '').'"> |
|
80
|
|
|
<div class="panel-body"> |
|
81
|
|
|
<ul class="nav navbar-nav"> |
|
82
|
|
|
'.$this->getChildMenuItems($item).' |
|
83
|
|
|
</ul> |
|
84
|
|
|
</div> |
|
85
|
|
|
</div> |
|
86
|
|
|
</li>'; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Get multilevel menu wrapper. |
|
91
|
|
|
* |
|
92
|
|
|
* @param \Rinvex\Menus\Models\MenuItem $item |
|
93
|
|
|
* |
|
94
|
|
|
* @return string |
|
95
|
|
|
*/ |
|
96
|
|
|
public function getMultiLevelDropdownWrapper(MenuItem $item): string |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->getMenuWithDropDownWrapper($item); |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.