Skip to content
Snippets Groups Projects

Issue #2845319 by bnjmnm, juanolalla, douggreen, gauravvvv, _utsavsharma,...

2 files
+ 25
25
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -204,16 +204,15 @@ public static function setLinkActiveClass($html_markup, $current_path, $is_front
}
// The query parameters of an active link are equal to the current
// parameters.
if ($add_active) {
if ($query) {
if (!$node->hasAttribute('data-drupal-link-query') || $node->getAttribute('data-drupal-link-query') !== Json::encode($query)) {
$add_active = FALSE;
}
}
else {
if ($node->hasAttribute('data-drupal-link-query')) {
$add_active = FALSE;
}
if ($add_active && $node->hasAttribute('data-drupal-link-query')) {
$query_match = empty(array_filter(
Json::decode($node->getAttribute('data-drupal-link-query')),
fn ($value, $key) => $value !== ($query[$key] ?? NULL),
ARRAY_FILTER_USE_BOTH
));
if (!$query_match) {
$add_active = FALSE;
}
}
Loading