1 | <?php namespace Arcanesoft\Sidebar; |
||
11 | class SidebarCollection extends Collection |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Main Methods |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | /** |
||
19 | * Push multiple sidebar items into the collection. |
||
20 | * |
||
21 | * @param array $items |
||
22 | * |
||
23 | * @return $this |
||
24 | */ |
||
25 | 52 | public function pushItems(array $items) |
|
26 | { |
||
27 | 52 | foreach ($items as $item) { |
|
28 | 16 | $this->pushItem($item); |
|
29 | } |
||
30 | |||
31 | 52 | return $this; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Push a new sidebar item to the collection. |
||
36 | * |
||
37 | * @param array $attributes |
||
38 | * |
||
39 | * @return $this |
||
40 | */ |
||
41 | 28 | public function pushItem(array $attributes) |
|
42 | { |
||
43 | 28 | return $this->push(new SidebarItem($attributes)); |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * Set the selected item. |
||
48 | * |
||
49 | * @param string $name |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | 12 | public function setSelected(string $name) |
|
59 | |||
60 | /** |
||
61 | * Check if there is any item selected. |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 16 | public function hasAnySelected() : bool |
|
71 | } |
||
72 |