diff --git a/src/Plugin/search_api/display/ViewsPageDisplay.php b/src/Plugin/search_api/display/ViewsPageDisplay.php index b1af1fe..f3c7031 100644 --- a/src/Plugin/search_api/display/ViewsPageDisplay.php +++ b/src/Plugin/search_api/display/ViewsPageDisplay.php @@ -20,9 +20,24 @@ class ViewsPageDisplay extends DisplayPluginBase { * {@inheritdoc} */ public function getPath() { + return Url::fromUserInput('/' . $this->getViewsPagePath()); + } + + /** + * {@inheritdoc} + */ + public function isRenderedInCurrentRequest() { + $url = \Drupal::request()->getPathInfo(); + return $url == '/' . $this->getViewsPagePath(); + } + + /** + * Returns the views page path for the current views page display. + */ + protected function getViewsPagePath(){ $view = Views::getView($this->pluginDefinition['view_id']); $view->setDisplay($this->pluginDefinition['view_display']); - return Url::fromUserInput('/' . $view->getDisplay()->getPath()); + return $view->getDisplay()->getPath(); } }