chg: [helper:bootstrap] Support of header in dropdown menu

pull/93/head
Sami Mokaddem 2021-11-10 09:29:27 +01:00
parent a005d0491f
commit a376055095
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 12 additions and 7 deletions

View File

@ -1876,12 +1876,10 @@ class BoostrapDropdownMenu extends BootstrapGeneric
if (!empty($entry['html'])) {
return $entry['html'];
}
$classes = ['dropdown-item'];
$params = ['href' => '#'];
$classes = [];
$icon = '';
if (!empty($entry['icon'])) {
$icon = $this->btHelper->icon($entry['icon']);
$icon = $this->btHelper->icon($entry['icon'], ['class' => 'me-2']);
}
$badge = '';
if (!empty($entry['badge'])) {
@ -1889,6 +1887,15 @@ class BoostrapDropdownMenu extends BootstrapGeneric
$badge = $bsBadge->badge();
}
if (!empty($entry['header'])) {
return $this->genNode('h6', [
'class' => ['dropdown-header',],
], $icon . h($entry['text']) . $badge);
}
$classes = ['dropdown-item'];
$params = ['href' => '#'];
if (!empty($entry['menu'])) {
$classes[] = 'dropdown-toggle';
$params['data-bs-toggle'] = 'dropdown';
@ -1900,9 +1907,7 @@ class BoostrapDropdownMenu extends BootstrapGeneric
$params['data-open-form-id'] = mt_rand();
}
$label = $this->genNode('span', [
'class' => ['ms-2',],
], h($entry['text']));
$label = $this->genNode('span', [], h($entry['text']));
$content = $icon . $label . $badge;
return $this->genNode('a', array_merge([