diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 2348408..41eab4d 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -10,6 +10,7 @@ use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Utility\Html; use Drupal\Component\Utility\SafeMarkup; +use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheableDependencyInterface; @@ -2102,6 +2103,24 @@ public function renderMoreLink() { if (!empty($this->view->exposed_raw_input)) { $url_options['query'] = $this->view->exposed_raw_input; } + + $parsed_url = UrlHelper::parse($url); + // Preserve the query string from url. + if (!empty($parsed_url['query'])) { + if (!empty($url_options['query'])) { + $url_options['query'] = array_merge($parsed_url['query'], $url_options['query']); + } + else { + $url_options['query'] = $parsed_url['query']; + } + $url = $parsed_url['path']; + } + // Add fragment if applicable. + if (!empty($parsed_url['fragment'])) { + $url_options['fragment'] = $parsed_url['fragment']; + } + + $url->setOptions($url_options); return array(