Skip to content

Commit

Permalink
[TASK] Simplify configuration access in GroupItemPaginateViewHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
dkd-friedrich authored and dkd-kaehm committed Jun 7, 2023
1 parent 4b58769 commit b1a2915
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Classes/ViewHelpers/GroupItemPaginateViewHelper.php
Expand Up @@ -92,26 +92,29 @@ public function render()

protected function getTemplateObject(): StandaloneView
{
$setup = $this->getConfigurationManager()->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
/** @var SearchResultSet $resultSet */
$resultSet = $this->arguments['resultSet'];
$configuration = $resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration();
$viewConfiguration = $configuration->getValueByPath('plugin.tx_solr.view.');

$layoutRootPaths = [];
$layoutRootPaths[] = GeneralUtility::getFileAbsFileName('EXT:solr/Resources/Private/Layouts/ViewHelpers/');
if (isset($setup['plugin.']['tx_solr.']['view.']['layoutRootPaths.'])) {
foreach ($setup['plugin.']['tx_solr.']['view.']['layoutRootPaths.'] as $layoutRootPath) {
if (isset($viewConfiguration['layoutRootPaths.'])) {
foreach ($viewConfiguration['layoutRootPaths.'] as $layoutRootPath) {
$layoutRootPaths[] = GeneralUtility::getFileAbsFileName(rtrim($layoutRootPath, '/') . '/ViewHelpers/');
}
}
$partialRootPaths = [];
$partialRootPaths[] = GeneralUtility::getFileAbsFileName('EXT:solr/Resources/Private/Partials/ViewHelpers/');
if (isset($setup['plugin.']['tx_solr.']['view.']['partialRootPaths.'])) {
foreach ($setup['plugin.']['tx_solr.']['view.']['partialRootPaths.'] as $partialRootPath) {
if (isset($viewConfiguration['partialRootPaths.'])) {
foreach ($viewConfiguration['partialRootPaths.'] as $partialRootPath) {
$partialRootPaths[] = GeneralUtility::getFileAbsFileName(rtrim($partialRootPath, '/') . '/ViewHelpers/');
}
}
$templateRootPaths = [];
$templateRootPaths[] = GeneralUtility::getFileAbsFileName('EXT:solr/Resources/Private/Templates/ViewHelpers/');
if (isset($setup['plugin.']['tx_solr.']['view.']['templateRootPaths.'])) {
foreach ($setup['plugin.']['tx_solr.']['view.']['templateRootPaths.'] as $templateRootPath) {
if (isset($viewConfiguration['templateRootPaths.'])) {
foreach ($viewConfiguration['templateRootPaths.'] as $templateRootPath) {
$templateRootPaths[] = GeneralUtility::getFileAbsFileName(rtrim($templateRootPath, '/') . '/ViewHelpers/');
}
}
Expand All @@ -127,6 +130,7 @@ protected function getTemplateObject(): StandaloneView

return $view;
}

/**
* Determines the number of results per page. When nothing is configured 10 will be returned.
*/
Expand Down

0 comments on commit b1a2915

Please sign in to comment.