diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 1d5c275..975a309 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()) { + if (($shortcut_url = $shortcut->getUrl()) && $shortcut_url->isRouted() && $shortcut_url->getRouteName() == $route_match->getRouteName() && $shortcut_url->getRouteParameters() == $route_match->getRawParameters()->all()) { $shortcut_id = $shortcut->id(); break; } diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php index 52ec545..494b473 100644 --- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -153,6 +153,16 @@ public function testShortcutQuickLink() { // 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.'); + + // Test two pages which use same route name but different route parameters. + $this->drupalGet('node/add/page'); + // Add Shortcut for Basic Page. + $this->clickLink('Add to Default shortcuts'); + $this->assertText('Added a shortcut for Create Basic page.'); + // Assure that Article does not have its shortcut indicated as set. + $this->drupalGet('node/add/article'); + $link = $this->xpath('//a[normalize-space()=:label]', array(':label' => 'Remove from Default shortcuts')); + $this->assertTrue(empty($link), 'Link Remove to Default shortcuts not found for Create Article page.'); } /**