diff --git a/core/modules/views/src/Plugin/views/area/DisplayLink.php b/core/modules/views/src/Plugin/views/area/DisplayLink.php index 57b1832ead..570034cd00 100644 --- a/core/modules/views/src/Plugin/views/area/DisplayLink.php +++ b/core/modules/views/src/Plugin/views/area/DisplayLink.php @@ -85,9 +85,9 @@ public function validate() { // are equal to the current display. We "only" show a warning, because even // though we recommend keeping the display options equal, we do not want to // enforce this. - if (!$this->isPathBasedDisplay($this->options['display']) || !$this->hasEqualSettings($this->options['display'])) { - $warning = $this->t('%display: The link in the %area area to the %linked_display display is invalid. Please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', [ - '%display' => $this->displayHandler->display['display_title'], + if (!$this->isPathBasedDisplay($this->options['display']) || !$this->hasEqualOptions($this->options['display'])) { + $warning = $this->t('%current_display: The link in the %area area points to the %linked_display display which uses different settings than the %current_display display. To make sure users see the exact same result when clicking the link, please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', [ + '%current_display' => $this->displayHandler->display['display_title'], '%area' => $this->areaType, '%linked_display' => $this->view->displayHandlers->get($this->options['display'])->display['display_title'], ]); @@ -153,9 +153,9 @@ protected function isPathBasedDisplay($display_id) { * The display ID to check. * * @return bool - * Whether the display ID is an allowed display or not. + * Whether the display ID has equal options to the current display. */ - protected function hasEqualSettings($display_id) { + protected function hasEqualOptions($display_id) { $loaded_display = $this->view->displayHandlers->get($display_id); $options = ['filters', 'sorts', 'pager', 'arguments']; foreach ($options as $option) { diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php index d35e1ee2ef..7614093b00 100644 --- a/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php @@ -302,11 +302,10 @@ protected function assertWarningMessages(ViewExecutable $view) { $messages = $messenger->messagesByType(MessengerInterface::TYPE_WARNING); $this->assertCount(4, $messages); - - $this->assertSame('Master: The link in the header area to the Page 1 display is invalid. Please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[0]->__toString()); - $this->assertSame('Block 1: The link in the header area to the Page 1 display is invalid. Please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[1]->__toString()); - $this->assertSame('Page 1: The link in the header area to the Page 2 display is invalid. Please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[2]->__toString()); - $this->assertSame('Page 2: The link in the header area to the Page 1 display is invalid. Please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[3]->__toString()); + $this->assertSame('Master: The link in the header area points to the Page 1 display which uses different settings than the Master display. To make sure users see the exact same result when clicking the link, please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[0]->__toString()); + $this->assertSame('Block 1: The link in the header area points to the Page 1 display which uses different settings than the Block 1 display. To make sure users see the exact same result when clicking the link, please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[1]->__toString()); + $this->assertSame('Page 1: The link in the header area points to the Page 2 display which uses different settings than the Page 1 display. To make sure users see the exact same result when clicking the link, please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[2]->__toString()); + $this->assertSame('Page 2: The link in the header area points to the Page 1 display which uses different settings than the Page 2 display. To make sure users see the exact same result when clicking the link, please check if the filter criteria, sort criteria, pager and contextual filters have the same settings.', $messages[3]->__toString()); $messenger->deleteAll(); }