core/modules/contextual/js/contextual.js | 2 +- core/modules/system/system.module | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/modules/contextual/js/contextual.js b/core/modules/contextual/js/contextual.js index 7f93a15..2e023be 100644 --- a/core/modules/contextual/js/contextual.js +++ b/core/modules/contextual/js/contextual.js @@ -55,7 +55,7 @@ .prepend(Drupal.theme('contextualTrigger')); // Set the destination parameter on each of the contextual links. - var destination = 'destination=' + Drupal.encodePath(drupalSettings.path.currentPath); + var destination = 'destination=' + Drupal.encodePath(drupalSettings.path.currentPathProcessed); $contextual.find('.contextual-links a').each(function () { var url = this.getAttribute('href'); var glue = (url.indexOf('?') === -1) ? '?' : '&'; diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 7bfe57b..a845d9b 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -664,11 +664,13 @@ function system_js_settings_alter(&$settings, AttachedAssetsInterface $assets) { $route_match = $route_match->getMasterRouteMatch(); } $current_path = $route_match->getRouteName() ? Url::fromRouteMatch($route_match)->getInternalPath() : ''; + $current_path_processed = $route_match->getRouteName() ? Url::fromRouteMatch($route_match)->setOptions(['query' => UrlHelper::buildQuery(UrlHelper::filterQueryParameters($current_query))])->toString(TRUE)->getGeneratedUrl() : ''; $current_path_is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route_match->getRouteObject()); $path_settings = [ 'baseUrl' => $request->getBaseUrl() . '/', 'pathPrefix' => $pathPrefix, 'currentPath' => $current_path, + 'currentPathProcessed' => $current_path_processed, 'currentPathIsAdmin' => $current_path_is_admin, 'isFront' => \Drupal::service('path.matcher')->isFrontPage(), 'currentLanguage' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId(),