allow string as button for in menu

This commit is contained in:
Uwe Steinmann 2025-11-08 19:42:11 +01:00
parent 55e6ce1b9b
commit 3c72b1f00c
2 changed files with 20 additions and 12 deletions

View File

@ -654,14 +654,18 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
<ul class="dropdown-menu"> <ul class="dropdown-menu">
'; ';
foreach($button['menuitems'] as $menuitem) { foreach($button['menuitems'] as $menuitem) {
$content .= ' if(is_array($menuitem)) {
$content .= '
<li><a'; <li><a';
if(!empty($menuitem['link'])) if(!empty($menuitem['link']))
$content .= ' href="'.$menuitem['link'].'"'; $content .= ' href="'.$menuitem['link'].'"';
if(!empty($menuitem['onclick'])) if(!empty($menuitem['onclick']))
$content .= ' onclick="'.$menuitem['onclick'].'"'; $content .= ' onclick="'.$menuitem['onclick'].'"';
$content .= '>'.$menuitem['label'].'</a><li> $content .= '>'.$menuitem['label'].'</a><li>
'; ';
} else {
$content .= $menuitem;
}
} }
$content .= ' $content .= '
</ul> </ul>

View File

@ -659,14 +659,18 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
<div class="dropdown-menu"> <div class="dropdown-menu">
'; ';
foreach($button['menuitems'] as $menuitem) { foreach($button['menuitems'] as $menuitem) {
$content .= ' if(is_array($menuitem)) {
$content .= '
<a class="dropdown-item"'; <a class="dropdown-item"';
if(!empty($menuitem['link'])) if(!empty($menuitem['link']))
$content .= ' href="'.$menuitem['link'].'"'; $content .= ' href="'.$menuitem['link'].'"';
if(!empty($menuitem['onclick'])) if(!empty($menuitem['onclick']))
$content .= ' onclick="'.$menuitem['onclick'].'"'; $content .= ' onclick="'.$menuitem['onclick'].'"';
$content .= '>'.$menuitem['label'].'</a> $content .= '>'.$menuitem['label'].'</a>
'; ';
} else {
$content .= $menuitem;
}
} }
$content .= ' $content .= '
</div> </div>