Skip to content

Commit 3de5e7a

Browse files
committed
Maintain old behaviour of the underlying query
1 parent badd14b commit 3de5e7a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Classes/Controller/SearchController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ public function detailAction(string $id): ResponseInterface
6060
$arguments
6161
);
6262

63-
$this->assetCollector->addInlineJavaScript('underlyingQueryVar', $underlyingQueryScriptTagContent, ['type' => 'text/javascript'], ['priority' => true]);
63+
$this->assetCollector->addInlineJavaScript('underlyingQueryVar', sprintf('const underlyingQuery = %s;', $underlyingQueryScriptTagContent), ['type' => 'text/javascript'], ['priority' => true]);
64+
6465
}
6566

6667
$this->addStandardAssignments();
6768

6869
$this->view->assignMultiple($detail);
6970
$this->view->assignMultiple([
71+
'underlyingQuery' => $underlyingQueryScriptTagContent,
7072
'arguments' => $arguments,
7173
'config' => $this->searchProvider->getConfiguration(),
7274
]);
@@ -92,7 +94,7 @@ public function indexAction(): ResponseInterface
9294
$this->searchProvider->getRequestArguments()
9395
);
9496

95-
$this->assetCollector->addInlineJavaScript('underlyingQueryVar', $underlyingQueryScriptTagContent, ['type' => 'text/javascript'], ['priority' => true]);
97+
$this->assetCollector->addInlineJavaScript('underlyingQueryVar', sprintf('const underlyingQuery = %s;', $underlyingQueryScriptTagContent), ['type' => 'text/javascript'], ['priority' => true]);
9698

9799
$this->addStandardAssignments();
98100
$defaultQuery = $this->searchProvider->getDefaultQuery();

Classes/Utility/FrontendUtility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static function addQueryInformationAsJavaScript(
7474
$underlyingQuery['sort'] = $arguments['sort'];
7575
}
7676

77-
return 'const underlyingQuery = ' . json_encode($underlyingQuery, JSON_THROW_ON_ERROR) . ';';
77+
return json_encode($underlyingQuery, JSON_THROW_ON_ERROR);
7878
}
7979

8080
return '';

0 commit comments

Comments
 (0)