diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 1171a86..fdcabf3 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -741,6 +741,20 @@ public function getPath() { /** * {@inheritdoc} */ + public function getRoutedDisplay() { + if ($this instanceof DisplayRouterInterface) { + return $this; + } + + $display_id = $this->getLinkDisplay(); + if ($display_id && $this->view->displayHandlers->has($display_id) && is_object($this->view->displayHandlers->get($display_id))) { + return $this->view->displayHandlers->get($display_id)->getRoutedDisplay(); + } + } + + /** + * {@inheritdoc} + */ public function getUrl() { return $this->view->getUrl(NULL, $this->display['id']); } diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php b/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php index e84348c..fedb662 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php @@ -213,6 +213,8 @@ public function getLinkDisplay(); */ public function getPath(); + public function getRoutedDisplay(); + public function getUrl(); /** diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 0db2973..844afc1 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -1727,7 +1727,10 @@ public function getUrl($args = NULL, $display_id = NULL) { $display_handler = $this->displayHandlers->get($display_id ?: $this->current_display); if (!$display_handler instanceof DisplayRouterInterface) { - throw new \InvalidArgumentException('You cannot create a URL to a display without routes.'); + $display_handler = $display_handler->getRoutedDisplay(); + if (!$display_handler instanceof DisplayRouterInterface) { + throw new \InvalidArgumentException('You cannot create a URL to a display without routes.'); + } } if (!isset($args)) {