From 1fb7bd72a445f635f98ce29772c350ba350ca0cf Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 18 May 2021 22:11:28 +0200 Subject: [PATCH] Fix broken RSS feeds after TYPO3 update --- .../Frontend/RssFeed/XmlSitemapRenderer.php | 24 +++++++++++++++---- Configuration/Services.yaml | 3 +++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Classes/Frontend/RssFeed/XmlSitemapRenderer.php b/Classes/Frontend/RssFeed/XmlSitemapRenderer.php index 605d257..dd65e46 100644 --- a/Classes/Frontend/RssFeed/XmlSitemapRenderer.php +++ b/Classes/Frontend/RssFeed/XmlSitemapRenderer.php @@ -32,20 +32,34 @@ class XmlSitemapRenderer extends Typo3XmlSitemapRenderer */ public $cObj; + private array $typoScriptConfiguration = []; + public function render(string $_, array $typoScriptConfiguration, ServerRequestInterface $request): string + { + $this->typoScriptConfiguration = $typoScriptConfiguration; + + return parent::render($_, $typoScriptConfiguration, $request); + } + + protected function initialize(array $fullConfiguration) + { + parent::initialize($fullConfiguration); + $this->view->assign('settings', $this->getSettings()); + } + + private function getSettings(): array { $settings = []; - foreach (array_keys($typoScriptConfiguration['userFunc.']['variables.'] ?? []) as $variableName) { + foreach (array_keys($this->typoScriptConfiguration['userFunc.']['variables.'] ?? []) as $variableName) { if (substr($variableName, -1) === '.') { continue; } $settings[$variableName] = $this->cObj->cObjGetSingle( - $typoScriptConfiguration['userFunc.']['variables.'][$variableName] ?? '', - $typoScriptConfiguration['userFunc.']['variables.'][$variableName . '.'] ?? [] + $this->typoScriptConfiguration['userFunc.']['variables.'][$variableName] ?? '', + $this->typoScriptConfiguration['userFunc.']['variables.'][$variableName . '.'] ?? [] ); } - $this->view->assign('settings', $settings); - return parent::render($_, $typoScriptConfiguration, $request); + return $settings; } } diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index d7003a1..c50b087 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -18,6 +18,9 @@ services: arguments: - 'pages' + DanielSiepmann\DsSite\Frontend\RssFeed\XmlSitemapRenderer: + public: true + DanielSiepmann\DsSite\Frontend\DataProcessing\CategoriesCounts: public: true arguments: