Skip to content

Commit

Permalink
WIP: changes bcz setting showCompat to $paramsToAdd also update red…
Browse files Browse the repository at this point in the history
…irect url
  • Loading branch information
sukhwinder33445 committed Nov 11, 2024
1 parent c676507 commit 2acb77c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/Compat/SearchControls.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public function createSearchBar(Query $query, ...$params): SearchBar
$redirectUrl = array_pop($params);

$requestUrlClone = $requestUrl->onlyWith($preserveParams);
$paramsToAdd = $requestUrlClone->getParams();
$paramsToAdd = $requestUrlClone->getParams()->toArray(false);

if ($redirectUrl !== null) {
$redirectUrl->addParams($paramsToAdd->toArray(false));
$redirectUrl->addParams($paramsToAdd);
} else {
$redirectUrl = $requestUrlClone;
}
Expand All @@ -86,10 +86,7 @@ public function createSearchBar(Query $query, ...$params): SearchBar
if (method_exists($this, 'completeAction')) {
$searchBar->setSuggestionUrl(Url::fromPath(
"$moduleName/$controllerName/complete",
$paramsToAdd
->set('_disableLayout', true)
->set('showCompact', true)
->toArray(false)
$paramsToAdd + ['_disableLayout' => true, 'showCompact' => true]
));
}

Expand Down Expand Up @@ -162,10 +159,10 @@ public function createSearchEditor(Query $query, ...$params): SearchEditor
$redirectUrl = array_pop($params);
$moduleName = $this->getRequest()->getModuleName();
$controllerName = $this->getRequest()->getControllerName();
$paramsToAdd = $requestUrl->onlyWith($preserveParams)->getParams();
$paramsToAdd = $requestUrl->onlyWith($preserveParams)->getParams()->toArray(false);

if ($redirectUrl !== null) {
$redirectUrl->addParams($paramsToAdd->toArray(false));
$redirectUrl->addParams($paramsToAdd);
} else {
$redirectUrl = Url::fromPath("$moduleName/$controllerName")
->setParams($paramsToAdd);
Expand All @@ -179,10 +176,7 @@ public function createSearchEditor(Query $query, ...$params): SearchEditor
if (method_exists($this, 'completeAction')) {
$editor->setSuggestionUrl(Url::fromPath(
"$moduleName/$controllerName/complete",
$paramsToAdd
->set('_disableLayout', true)
->set('showCompact', true)
->toArray(false)
$paramsToAdd + ['_disableLayout' => true, 'showCompact' => true]
));
}

Expand Down

0 comments on commit 2acb77c

Please sign in to comment.