Skip to content

Commit

Permalink
Merge pull request #2660 from splitbrain/issue-2647
Browse files Browse the repository at this point in the history
don't show empty optiongroup item in Mobilemenu
  • Loading branch information
splitbrain committed Jan 8, 2019
2 parents 3c6f8fa + 5940772 commit d4af363
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions inc/Menu/MobileMenu.php
Expand Up @@ -70,14 +70,16 @@ public function getDropdown($empty = '', $button = '>') {
$html .= '<option value="">' . $empty . '</option>';

foreach($this->getGroupedItems() as $tools => $items) {
$html .= '<optgroup label="' . $lang[$tools . '_tools'] . '">';
foreach($items as $item) {
$params = $item->getParams();
$html .= '<option value="' . $params['do'] . '">';
$html .= hsc($item->getLabel());
$html .= '</option>';
if (count($items)) {
$html .= '<optgroup label="' . $lang[$tools . '_tools'] . '">';
foreach($items as $item) {
$params = $item->getParams();
$html .= '<option value="' . $params['do'] . '">';
$html .= hsc($item->getLabel());
$html .= '</option>';
}
$html .= '</optgroup>';
}
$html .= '</optgroup>';
}

$html .= '</select>';
Expand Down

0 comments on commit d4af363

Please sign in to comment.