From 30487497e705584abe645a7f70c63f5b8995f7ce Mon Sep 17 00:00:00 2001 From: ebremner Date: Tue, 30 Nov 2021 10:15:47 -0500 Subject: [PATCH 1/2] ISTWCMS-5232: fixing URL where catalog search goes too --- src/Form/CatalogSearchForm.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Form/CatalogSearchForm.php b/src/Form/CatalogSearchForm.php index 7cb8aaf..e12a4e3 100644 --- a/src/Form/CatalogSearchForm.php +++ b/src/Form/CatalogSearchForm.php @@ -262,9 +262,9 @@ class CatalogSearchForm extends FormBase { // search all catalogs or specific and set things accordingly. if ($tid === NULL) { - // Get the current route as the view for catalog - // search will handle all and specific, based on URL. - $url .= Url::fromRoute('')->toString(); + // Get the current path and alias. + $current_path = \Drupal::service('path.current')->getPath(); + $url .= \Drupal::service('path_alias.manager')->getAliasByPath($current_path); } else { @@ -283,7 +283,7 @@ class CatalogSearchForm extends FormBase { $url .= '/search?search-input=' . $values['search_input']; // Get a URL object. - $url = Url::fromUri($url); + $url = Url::fromUri($url, ['absolute' => TRUE]); // Set the form redirection URL. $form_state->setRedirectUrl($url); -- GitLab From 9e02e5ea151fb7f03ec3082240114ab9537ad86d Mon Sep 17 00:00:00 2001 From: ebremner Date: Tue, 30 Nov 2021 10:17:15 -0500 Subject: [PATCH 2/2] ISTWCMS-5232: coding standards --- src/Form/CatalogSearchForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Form/CatalogSearchForm.php b/src/Form/CatalogSearchForm.php index e12a4e3..93a0f84 100644 --- a/src/Form/CatalogSearchForm.php +++ b/src/Form/CatalogSearchForm.php @@ -263,8 +263,8 @@ class CatalogSearchForm extends FormBase { if ($tid === NULL) { // Get the current path and alias. - $current_path = \Drupal::service('path.current')->getPath(); - $url .= \Drupal::service('path_alias.manager')->getAliasByPath($current_path); + $current_path = $this->currentPath->getPath(); + $url .= $this->aliasManager->getAliasByPath($current_path); } else { -- GitLab