From e868cfeaf480fd7c37b871065ab0ad38a9ff382e Mon Sep 17 00:00:00 2001 From: Brandon Shipley Date: Sat, 29 Mar 2025 01:47:07 -0700 Subject: [PATCH] active link helper allow for arrays in target params --- src/View/Helper/ActiveLinkHelper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/View/Helper/ActiveLinkHelper.php b/src/View/Helper/ActiveLinkHelper.php index 6a83945..04520eb 100644 --- a/src/View/Helper/ActiveLinkHelper.php +++ b/src/View/Helper/ActiveLinkHelper.php @@ -62,7 +62,12 @@ class ActiveLinkHelper extends Helper } foreach ($target as $targetKey => $targetValue) { if (is_array($targetValue)) { - return 'test'; + if (!in_array($currentUrl[$targetKey], $targetValue)) { + return $this->Html->link($title, $url, $options); + } + $options['class'] = $this->_addClass($options); + + return $this->Html->link($title, $url, $options); } if (!array_key_exists($targetKey, $currentUrl) || $targetValue != $currentUrl[$targetKey]) { return $this->Html->link($title, $url, $options);