diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index af62baccc597ccc9aff23e2e3fc0d4252e4fa992..b406bc5c3c301d9fe6c14227b25f1b00136ec388 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -321,7 +321,7 @@ function shortcut_preprocess_page(&$variables) { $shortcuts = \Drupal::entityManager()->getStorage('shortcut')->loadByProperties(array('shortcut_set' => $shortcut_set->id())); /** @var \Drupal\shortcut\ShortcutInterface $shortcut */ foreach ($shortcuts as $shortcut) { - if (($shortcut_url = $shortcut->getUrl()) && $shortcut_url->isRouted() && $shortcut_url->getRouteName() == $route_match->getRouteName() && $shortcut_url->getRouteParameters() == $route_match->getParameters()->all()) { + if (($shortcut_url = $shortcut->getUrl()) && $shortcut_url->isRouted() && $shortcut_url->getRouteName() == $route_match->getRouteName()) { $shortcut_id = $shortcut->id(); break; } diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php index 7adc1ada7a3ef66863ca972babd6061bb0cd1514..032cf6fae3f1dd0c550145bf0b7a48e436a73f96 100644 --- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -135,6 +135,24 @@ public function testShortcutQuickLink() { $this->drupalGet('admin/structure'); $this->assertNoLink('Cron', 'Shortcut link removed from different page'); + + $this->drupalGet('admin/people'); + + // Test the "Add to shortcuts" link for a page generated by views. + $this->clickLink('Add to Default shortcuts'); + $this->assertText('Added a shortcut for People.'); + // Due to the structure of the markup in the link ::assertLink() doesn't + // works here. + $link = $this->xpath('//a[normalize-space()=:label]', array(':label' => 'Remove from Default shortcuts')); + $this->assertTrue(!empty($link), 'Link Remove from Default shortcuts found.'); + + // Test the "Remove from shortcuts" link for a page generated by views. + $this->clickLink('Remove from Default shortcuts'); + $this->assertText('The shortcut People has been deleted.'); + // Due to the structure of the markup in the link ::assertLink() doesn't + // works here. + $link = $this->xpath('//a[normalize-space()=:label]', array(':label' => 'Add to Default shortcuts')); + $this->assertTrue(!empty($link), 'Link Add to Default shortcuts found.'); } /**