Skip to content

Commit

Permalink
[FIX] Re-added template variables for SearchFormViewHelper
Browse files Browse the repository at this point in the history
This PR re-introduces the template variables in the SearchFormViewHelper

Cherry-Picked from: 8f60143
Fixes: #4117
Ports: #4118
  • Loading branch information
thomashohn authored and dkd-kaehm committed Nov 29, 2024
1 parent c2558c1 commit f7ad16a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Classes/ViewHelpers/SearchFormViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function initializeArguments(): void
}

/**
* Render search form tag
* Renders search form-tag
*
* @throws AspectNotFoundException
* @noinspection PhpMissingReturnTypeInspection
Expand Down Expand Up @@ -110,12 +110,32 @@ public function render()
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->add('q', $this->getQueryString());
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->add('pageUid', $pageUid);
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->add(
'languageUid',
(
$this->renderingContext
->getAttribute(ServerRequestInterface::class)
->getAttribute('language')
?->getLanguageId() ?? 0
)
);
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->add('existingParameters', $this->getExistingSearchParameters());
// @extensionScannerIgnoreLine
// Added addPageAndLanguageId for compatibility
$this->getTemplateVariableContainer()->add('addPageAndLanguageId', false);
$formContent = $this->renderChildren();
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->remove('addPageAndLanguageId');
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->remove('q');
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->remove('pageUid');
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->remove('languageUid');
// @extensionScannerIgnoreLine
$this->getTemplateVariableContainer()->remove('existingParameters');

$this->tag->setContent($formContent);
Expand Down

0 comments on commit f7ad16a

Please sign in to comment.