Unverified Commit ef8a5c3d authored by alexpott's avatar alexpott

Issue #2968541 by vokidas, borisson_: ActiveLinkResponseFilter fails to set...

Issue #2968541 by vokidas, borisson_: ActiveLinkResponseFilter fails to set active link with query in non-alphabetical order
parent 4ed1bcf6
......@@ -127,6 +127,9 @@ public static function setLinkActiveClass($html_markup, $current_path, $is_front
$search_key_current_path = 'data-drupal-link-system-path="' . $current_path . '"';
$search_key_front = 'data-drupal-link-system-path="<front>"';
// Receive the query in a standardized manner.
ksort($query);
$offset = 0;
// There are two distinct conditions that can make a link be marked active:
// 1. A link has the current path in its 'data-drupal-link-system-path'
......
......@@ -238,6 +238,19 @@ public function providerTestSetLinkActiveClass() {
$situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => ""]];
$situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => TRUE]];
// Query with unsorted keys must match when the attribute is in sorted form.
$context = [
'path' => 'myfrontpage',
'front' => TRUE,
'language' => 'en',
'query' => ['foo' => 'bar', 'baz' => 'qux'],
];
$attributes = [
'data-drupal-link-system-path' => 'myfrontpage',
'data-drupal-link-query' => Json::encode(['baz' => 'qux', 'foo' => 'bar']),
];
$situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes];
// Loop over the surrounding HTML variations.
$data = [];
for ($h = 0; $h < count($html); $h++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment