1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Rinvex\Menus\Presenters; |
6
|
|
|
|
7
|
|
|
use Rinvex\Menus\Models\MenuItem; |
8
|
|
|
|
9
|
|
|
class AdminltePresenter extends BasePresenter |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* {@inheritdoc} |
13
|
|
|
*/ |
14
|
|
|
public function getOpenTagWrapper(): string |
15
|
|
|
{ |
16
|
|
|
return '<ul class="sidebar-menu tree" data-widget="tree">'; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* {@inheritdoc} |
21
|
|
|
*/ |
22
|
|
|
public function getCloseTagWrapper(): string |
23
|
|
|
{ |
24
|
|
|
return '</ul>'; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* {@inheritdoc} |
29
|
|
|
*/ |
30
|
|
|
public function getDividerWrapper(): string |
31
|
|
|
{ |
32
|
|
|
return '<li class="divider"></li>'; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* {@inheritdoc} |
37
|
|
|
*/ |
38
|
|
|
public function getHeaderWrapper(MenuItem $item): string |
39
|
|
|
{ |
40
|
|
|
return '<li class="header">'.($item->icon ? '<i class="'.$item->icon.'"></i> ' : '').$item->title.'</li>'; |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
*/ |
46
|
|
|
public function getMenuWithoutDropdownWrapper(MenuItem $item): string |
47
|
|
|
{ |
48
|
|
|
return '<li class="'.($item->isActive() ? 'active' : '').'"> |
49
|
|
|
<a href="'.$item->getUrl().'" '.$item->getAttributes().'> |
50
|
|
|
'.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').' |
|
|
|
|
51
|
|
|
<span>'.$item->title.'</span> |
|
|
|
|
52
|
|
|
</a> |
53
|
|
|
</li>'; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* {@inheritdoc} |
58
|
|
|
*/ |
59
|
|
|
public function getMenuWithDropDownWrapper(MenuItem $item, bool $specialSidebar = false): string |
60
|
|
|
{ |
61
|
|
|
return $specialSidebar |
62
|
|
|
? $this->getHeaderWrapper($item).$this->getChildMenuItems($item) |
63
|
|
|
: '<li class="treeview'.($item->hasActiveOnChild() ? ' active' : '').'"> |
64
|
|
|
<a href="#"> |
65
|
|
|
'.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').' |
|
|
|
|
66
|
|
|
<span>'.$item->title.'</span> |
|
|
|
|
67
|
|
|
<span class="pull-right-container"> |
68
|
|
|
<i class="fa fa-angle-left pull-right"></i> |
69
|
|
|
</span> |
70
|
|
|
</a> |
71
|
|
|
<ul class="treeview-menu"> |
72
|
|
|
'.$this->getChildMenuItems($item).' |
73
|
|
|
</ul> |
74
|
|
|
</li>'; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Get multilevel menu wrapper. |
79
|
|
|
* |
80
|
|
|
* @param \Rinvex\Menus\Models\MenuItem $item |
81
|
|
|
* |
82
|
|
|
* @return string` |
|
|
|
|
83
|
|
|
*/ |
84
|
|
|
public function getMultiLevelDropdownWrapper(MenuItem $item): string |
85
|
|
|
{ |
86
|
|
|
return '<li class="treeview'.($item->hasActiveOnChild() ? ' active' : '').'"> |
87
|
|
|
<a href="#"> |
88
|
|
|
'.($item->icon ? '<i class="'.$item->icon.'"></i>' : '').' |
|
|
|
|
89
|
|
|
<span>'.$item->title.'</span> |
|
|
|
|
90
|
|
|
<span class="pull-right-container"> |
91
|
|
|
<i class="fa fa-angle-left pull-right"></i> |
92
|
|
|
</span> |
93
|
|
|
</a> |
94
|
|
|
<ul class="treeview-menu"> |
95
|
|
|
'.$this->getChildMenuItems($item).' |
96
|
|
|
</ul> |
97
|
|
|
</li>'; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.