| @@ 44-56 (lines=13) @@ | ||
| 41 | * @param MenuitemEntity $item |
|
| 42 | * @param Builder $menu |
|
| 43 | */ |
|
| 44 | public function addItemToMenu(MenuitemEntity $item, Builder $menu) |
|
| 45 | { |
|
| 46 | if ($this->hasChildren($item)) { |
|
| 47 | $this->addChildrenToMenu($item->title, $item->items, $menu); |
|
| 48 | } else { |
|
| 49 | $target = $item->uri ?: $item->url; |
|
| 50 | $menu->url( |
|
| 51 | $target, |
|
| 52 | $item->title, |
|
| 53 | ['target' => $item->target] |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Add children to menu under the give name |
|
| @@ 125-133 (lines=9) @@ | ||
| 122 | * @param Menuitem $child |
|
| 123 | * @param PingpongMenuItem $sub |
|
| 124 | */ |
|
| 125 | private function addSubItemToMenu(Menuitem $child, PingpongMenuItem $sub) |
|
| 126 | { |
|
| 127 | if ($this->hasChildren($child)) { |
|
| 128 | $this->addChildrenToMenu($child->title, $child->items, $sub); |
|
| 129 | } else { |
|
| 130 | $target = $child->uri ?: $child->url; |
|
| 131 | $sub->url($target, $child->title, 0, ['icon' => $child->icon]); |
|
| 132 | } |
|
| 133 | } |
|
| 134 | ||
| 135 | /** |
|
| 136 | * Check if the given menu item has children |
|