From 9013a7ce2b5a551b6bfd752470f3f889da55f397 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 13 Feb 2023 15:18:07 +0100 Subject: [PATCH] chg: [boostrapElement:dropdownMenu] Added support of `attrs` parameter for menu entry --- src/View/Helper/BootstrapElements/BootstrapDropdownMenu.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/View/Helper/BootstrapElements/BootstrapDropdownMenu.php b/src/View/Helper/BootstrapElements/BootstrapDropdownMenu.php index 2357492..58110d1 100644 --- a/src/View/Helper/BootstrapElements/BootstrapDropdownMenu.php +++ b/src/View/Helper/BootstrapElements/BootstrapDropdownMenu.php @@ -13,7 +13,7 @@ use App\View\Helper\BootstrapHelper; * - button: Configuration for the dropdown button to be passed to BootstrapElements\BootstrapButton * - submenu_alignment: Alignment of the child dropdown will be displayed Valid: "start", "end", "up", "down" * - submenu_direction: Position where the child dropdown will be displayed Valid: "start", "end", "up", "down" - * - attrs: Additional HTML attributes tro be applied on the dropdown container + * - attrs: Additional HTML attributes to be applied on the dropdown container * - menu: Entries making the dropdown menu. Accept the following options: * - text: Text of the entry * - html: HTML of the entry @@ -22,6 +22,7 @@ use App\View\Helper\BootstrapHelper; * - header: Is this item a list header * - keepOpen: Keep the dropdown open if this entry is clicked * - sup: Additional text to be added as a element + * - attrs: Additional HTML attributes to be applied on the entry * * # Usage: * $this->Bootstrap->dropdownMenu([ @@ -183,7 +184,8 @@ class BootstrapDropdownMenu extends BootstrapGeneric } $classes = array_merge($classes, $entry['class']); } - $params = ['href' => '#']; + $params = $entry['attrs'] ?? []; + $params['href'] = '#'; if (!empty($entry['menu'])) { $classes[] = 'dropdown-toggle';