From 9ab1de7f5e505d2ad265e81ee5c274285a1bb323 Mon Sep 17 00:00:00 2001 From: NiclasNorin <103985736+NiclasNorin@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:55:13 +0200 Subject: [PATCH] Feat: Drawer close button color (#319) * Feat: Drawer close button color * Refactor: Removing old code * Fix: Potential errors and multple handling --------- Co-authored-by: Niclas Norin Co-authored-by: Sebastian Thulin --- source/php/Component/Drawer/drawer.blade.php | 3 +-- source/php/Component/Select/Select.php | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/php/Component/Drawer/drawer.blade.php b/source/php/Component/Drawer/drawer.blade.php index 31705111..72ebd9ca 100644 --- a/source/php/Component/Drawer/drawer.blade.php +++ b/source/php/Component/Drawer/drawer.blade.php @@ -14,11 +14,10 @@ 'data-simulate-click' => $simulateClickSelector ], 'classList' => [ - 'c-drawer__close' + 'c-drawer__close', ], 'size' => 'md', 'text' => $label, - 'context' => 'drawer.closeButton' ]) @endbutton diff --git a/source/php/Component/Select/Select.php b/source/php/Component/Select/Select.php index 39374fbd..30cd44e5 100644 --- a/source/php/Component/Select/Select.php +++ b/source/php/Component/Select/Select.php @@ -9,8 +9,11 @@ public function init() //Extract array for eazy access (fetch only) extract($this->data); - //Create an random id if not assigned to the component. - $this->data['id'] = $id = $id ? $id : uniqid(); + // Must include a id. + if (empty($id)) { + $id = $this->data['id'] = uniqid(); + } + $this->data['attributeList']['id'] = "select_{$id}"; //Set icon size $this->data['iconSize'] = $this->getIconSize($size); @@ -59,7 +62,7 @@ public function init() } $this->data['intersection'] = []; - if (is_array($preselected) && !empty($options)) { + if (!empty($options) && is_array($preselected)) { // Create an associative array from $preselected with keys same as values $preselectedKeys = array_flip($preselected);