1 | <?php |
||
2 | |||
3 | namespace KyleMassacre\Menus\Presenters\Foundation; |
||
4 | |||
5 | use KyleMassacre\Menus\Contracts\MenuItemContract; |
||
6 | use KyleMassacre\Menus\Presenters\Presenter; |
||
7 | |||
8 | class ZurbMenuPresenter extends Presenter |
||
9 | { |
||
10 | /** |
||
11 | * {@inheritdoc } |
||
12 | */ |
||
13 | public function getOpenTagWrapper(): ?string |
||
14 | { |
||
15 | return PHP_EOL . '<nav class="custom-main"> |
||
16 | <ul class="dropdown menu" data-dropdown-menu>' . PHP_EOL; |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * {@inheritdoc } |
||
21 | */ |
||
22 | public function getCloseTagWrapper(): ?string |
||
23 | { |
||
24 | return PHP_EOL . '</ul></nav>' . PHP_EOL; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc } |
||
29 | */ |
||
30 | public function getMenuWithoutDropdownWrapper(MenuItemContract $item): ?string |
||
31 | { |
||
32 | return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '">' . $item->title . '</a></li>'; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc } |
||
37 | */ |
||
38 | public function getActiveState(MenuItemContract $item): ?string |
||
39 | { |
||
40 | return \Request::is($item->getRequest()) ? ' class="is-active"' : null; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc } |
||
45 | */ |
||
46 | public function getDividerWrapper(): ?string |
||
47 | { |
||
48 | return '<li class="divider"></li>'; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc } |
||
53 | */ |
||
54 | public function getMenuWithDropDownWrapper(MenuItemContract $item): ?string |
||
55 | { |
||
56 | return '<li class="dropdown dropdown-primary"> |
||
57 | <a class="dropdown-toggle" href="#">' . $item->title . '</a> |
||
0 ignored issues
–
show
The property
title does not exist on KyleMassacre\Menus\Contracts\MenuItemContract . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
58 | <ul class="menu"> |
||
59 | ' . $this->getChildMenuItems($item) . ' |
||
60 | </ul> |
||
61 | </li>' . PHP_EOL; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc } |
||
66 | */ |
||
67 | public function getMultiLevelDropdownWrapper($item): string |
||
68 | { |
||
69 | return '<li> |
||
70 | <a href="#">' . $item->title . '</a> |
||
71 | <ul class="menu"> |
||
72 | ' . $this->getChildMenuItems($item) . ' |
||
73 | </ul> |
||
74 | </li>' . PHP_EOL; |
||
75 | } |
||
76 | } |
||
77 |