1 | <?php namespace Arcanesoft\Sidebar; |
||
12 | class Manager implements ManagerContract |
||
13 | { |
||
14 | /* ----------------------------------------------------------------- |
||
15 | | Properties |
||
16 | | ----------------------------------------------------------------- |
||
17 | */ |
||
18 | |||
19 | /** @var \Arcanesoft\Sidebar\Collection */ |
||
20 | protected $items; |
||
21 | |||
22 | /** @var bool */ |
||
23 | protected $shown = true; |
||
24 | |||
25 | /* ----------------------------------------------------------------- |
||
26 | | Constructor |
||
27 | | ----------------------------------------------------------------- |
||
28 | */ |
||
29 | |||
30 | 24 | public function __construct() |
|
34 | |||
35 | /* ----------------------------------------------------------------- |
||
36 | | Getters & Setters |
||
37 | | ----------------------------------------------------------------- |
||
38 | */ |
||
39 | |||
40 | /** |
||
41 | * Set the selected item. |
||
42 | * |
||
43 | * @param string $name |
||
44 | * |
||
45 | * @return $this |
||
46 | */ |
||
47 | 4 | public function setSelectedItem(string $name) |
|
53 | |||
54 | /** |
||
55 | * Get the sidebar items. |
||
56 | * |
||
57 | * @return \Arcanesoft\Sidebar\Collection |
||
58 | */ |
||
59 | 20 | public function items() |
|
63 | |||
64 | /* ----------------------------------------------------------------- |
||
65 | | Main Methods |
||
66 | | ----------------------------------------------------------------- |
||
67 | */ |
||
68 | |||
69 | /** |
||
70 | * Load the sidebar items from config files. |
||
71 | * |
||
72 | * @param array $items |
||
73 | * |
||
74 | * @return $this |
||
75 | */ |
||
76 | 4 | public function loadFromArray(array $items) |
|
86 | |||
87 | /** |
||
88 | * Load sidebar items from config file(s). |
||
89 | * |
||
90 | * @param string $key |
||
91 | * |
||
92 | * @return $this |
||
93 | */ |
||
94 | 8 | public function loadFromConfig($key) |
|
114 | |||
115 | /** |
||
116 | * Add an item from array. |
||
117 | * |
||
118 | * @param array $item |
||
119 | * |
||
120 | * @return $this |
||
121 | */ |
||
122 | 16 | public function add(array $item) |
|
128 | |||
129 | /** |
||
130 | * Show the sidebar. |
||
131 | * |
||
132 | * @return $this |
||
133 | */ |
||
134 | 4 | public function show() |
|
140 | |||
141 | /** |
||
142 | * Hide the sidebar. |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | 4 | public function hide() |
|
152 | |||
153 | /* ----------------------------------------------------------------- |
||
154 | | Check Methods |
||
155 | | ----------------------------------------------------------------- |
||
156 | */ |
||
157 | |||
158 | /** |
||
159 | * Check if the sidebar has items. |
||
160 | * |
||
161 | * @return bool |
||
162 | */ |
||
163 | 12 | public function hasItems() |
|
167 | |||
168 | /** |
||
169 | * Check if the sidebar is shown. |
||
170 | * |
||
171 | * @return bool |
||
172 | */ |
||
173 | 4 | public function isShown() |
|
177 | } |
||
178 |