Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 421a3f6

Browse files
committed
menu fix
1 parent f32a7a4 commit 421a3f6

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

collections/Menu.php

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,15 @@ public function renderItems()
207207
{
208208
Html::addCssClass($this->rightMenuOptions, 'right menu');
209209
Html::addCssClass($this->subMenuOptions, 'ui sub menu');
210+
211+
$leftMenuPart = $this->items ? $this->renderMenuPart($this->items) : '';
212+
$rightMenuPart = $this->rightMenuItems ? Html::tag('div', $this->renderMenuPart($this->rightMenuItems), $this->rightMenuOptions) : '';
210213
return
211214
(
212215
$this->tiered
213216
?
214-
Html::tag('div', $this->renderMenuPart($this->items) . Html::tag('div', $this->renderMenuPart($this->rightMenuItems), $this->rightMenuOptions), ['class' => 'menu'])
215-
: $this->renderMenuPart($this->items) . Html::tag('div', $this->renderMenuPart($this->rightMenuItems), $this->rightMenuOptions)
217+
Html::tag('div', $leftMenuPart . $rightMenuPart, ['class' => 'menu'])
218+
: $leftMenuPart . $rightMenuPart
216219
) .
217220
($this->subMenuItems ? Html::tag('div', $this->renderMenuPart($this->subMenuItems), $this->subMenuOptions) : '');
218221
}
@@ -224,32 +227,28 @@ public function renderItems()
224227
*/
225228
public function renderMenuPart($items)
226229
{
227-
if ($items) {
228-
$items = $this->normalizeItems($items, $hasActiveChild);
229-
230-
$lines = '';
231-
foreach ($items as $i => $item) {
232-
Html::addCssClass($item['options'], 'item');
233-
if ($item['active']) {
234-
Html::addCssClass($item['options'], 'active');
235-
}
230+
$items = $this->normalizeItems($items, $hasActiveChild);
236231

237-
if (isset($item['items'])) {
238-
Html::addCssClass($item['options'], 'ui simple dropdown');
239-
$item['label'] =
240-
$item['label'] .
241-
Elements::icon('dropdown') .
242-
Html::tag('div', $this->renderMenuPart($item['items']), ['class' => 'menu']);
243-
$menu = $this->renderItem($item);
244-
} else {
245-
$menu = $this->renderItem($item);
246-
}
247-
$lines .= $menu;
232+
$lines = '';
233+
foreach ($items as $i => $item) {
234+
Html::addCssClass($item['options'], 'item');
235+
if ($item['active']) {
236+
Html::addCssClass($item['options'], 'active');
248237
}
249-
return $lines;
250-
} else {
251-
return '';
238+
239+
if (isset($item['items'])) {
240+
Html::addCssClass($item['options'], 'ui simple dropdown');
241+
$item['label'] =
242+
$item['label'] .
243+
Elements::icon('dropdown') .
244+
Html::tag('div', $this->renderMenuPart($item['items']), ['class' => 'menu']);
245+
$menu = $this->renderItem($item);
246+
} else {
247+
$menu = $this->renderItem($item);
248+
}
249+
$lines .= $menu;
252250
}
251+
return $lines;
253252
}
254253

255254
/**

0 commit comments

Comments
 (0)