ew_base/Classes/DataProcessing/ContainerProcessor.php
Sebastian Fischer 5319bd35a5 First commit
2024-02-09 17:13:28 +01:00

59 lines
2.1 KiB
PHP
Executable File

<?php
declare(strict_types=1);
namespace Evoweb\EwBase\DataProcessing;
/*
* This file is part of TYPO3 CMS-based extension "container" by b13.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*/
use B13\Container\DataProcessing\ContainerProcessor as BaseContainerProcessor;
use B13\Container\Domain\Model\Container;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\ContentObject\RecordsContentObject;
class ContainerProcessor extends BaseContainerProcessor
{
protected function processColPos(
ContentObjectRenderer $cObj,
Container $container,
int $colPos,
string $as,
array $processedData,
array $processorConfiguration
): array {
$children = $container->getChildrenByColPos($colPos);
if (!$processorConfiguration['doNotProcessChildren']) {
$contentRecordRenderer = new RecordsContentObject();
$conf = [
'tables' => 'tt_content'
];
foreach ($children as &$child) {
if ($child['l18n_parent'] > 0) {
$conf['source'] = $child['l18n_parent'];
} else {
$conf['source'] = $child['uid'];
}
if ($child['t3ver_oid'] > 0) {
$conf['source'] = $child['t3ver_oid'];
}
$child['renderedContent'] = $cObj->render($contentRecordRenderer, $conf);
/** @var ContentObjectRenderer $recordContentObjectRenderer */
$recordContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$recordContentObjectRenderer->start($child, 'tt_content');
$child = $this->contentDataProcessor->process($recordContentObjectRenderer, $processorConfiguration, $child);
}
}
$processedData[$as] = $children;
return $processedData;
}
}