Fix broken RSS feeds after TYPO3 update

This commit is contained in:
Daniel Siepmann 2021-05-18 22:11:28 +02:00
parent 59fce3b037
commit 1fb7bd72a4
2 changed files with 22 additions and 5 deletions

View file

@ -32,20 +32,34 @@ class XmlSitemapRenderer extends Typo3XmlSitemapRenderer
*/ */
public $cObj; public $cObj;
private array $typoScriptConfiguration = [];
public function render(string $_, array $typoScriptConfiguration, ServerRequestInterface $request): string 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 = []; $settings = [];
foreach (array_keys($typoScriptConfiguration['userFunc.']['variables.'] ?? []) as $variableName) { foreach (array_keys($this->typoScriptConfiguration['userFunc.']['variables.'] ?? []) as $variableName) {
if (substr($variableName, -1) === '.') { if (substr($variableName, -1) === '.') {
continue; continue;
} }
$settings[$variableName] = $this->cObj->cObjGetSingle( $settings[$variableName] = $this->cObj->cObjGetSingle(
$typoScriptConfiguration['userFunc.']['variables.'][$variableName] ?? '', $this->typoScriptConfiguration['userFunc.']['variables.'][$variableName] ?? '',
$typoScriptConfiguration['userFunc.']['variables.'][$variableName . '.'] ?? [] $this->typoScriptConfiguration['userFunc.']['variables.'][$variableName . '.'] ?? []
); );
} }
$this->view->assign('settings', $settings);
return parent::render($_, $typoScriptConfiguration, $request); return $settings;
} }
} }

View file

@ -18,6 +18,9 @@ services:
arguments: arguments:
- 'pages' - 'pages'
DanielSiepmann\DsSite\Frontend\RssFeed\XmlSitemapRenderer:
public: true
DanielSiepmann\DsSite\Frontend\DataProcessing\CategoriesCounts: DanielSiepmann\DsSite\Frontend\DataProcessing\CategoriesCounts:
public: true public: true
arguments: arguments: