diff --git a/src/Form/CatalogSearchForm.php b/src/Form/CatalogSearchForm.php index 7cb8aaf3ece021c455500e9dcc78a1f40847bacf..93a0f84624807e7181a5812fb540c6ac3e99fdb9 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 = $this->currentPath->getPath(); + $url .= $this->aliasManager->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);