Add Container Options
This commit is contained in:
1 parent
f515de54ad
commit
c720696781
23 files changed
+584
-22
No files matched your search
@@ -11,6 +11,7 @@ use TYPO3\CMS\Core\Attribute\AsAllowedCallable;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Service\FlexFormService;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||
|
||||
/**
|
||||
* UserFunc: render a single Success Story as JSON (headless).
|
||||
@@ -21,12 +22,27 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
*/
|
||||
class UsecaseShowJsonRenderer
|
||||
{
|
||||
private ?ContentObjectRenderer $cObj = null;
|
||||
|
||||
/**
|
||||
* TYPO3 v14 hands the ContentObjectRenderer over through this setter only -
|
||||
* ContentObjectRenderer::callUserFunction() duck-types it with
|
||||
* is_callable([$classObj, 'setContentObjectRenderer']). Without the method
|
||||
* $this->cObj stays null, the cObj branch of render() never fires and the
|
||||
* call falls through to page discovery, which picks the FIRST element of
|
||||
* this CType on the page rather than the one actually being rendered.
|
||||
*/
|
||||
public function setContentObjectRenderer(ContentObjectRenderer $cObj): void
|
||||
{
|
||||
$this->cObj = $cObj;
|
||||
}
|
||||
|
||||
private const TABLE = 'tx_vitec_domain_model_usecase';
|
||||
|
||||
#[AsAllowedCallable]
|
||||
public function render(string $content, array $conf): string
|
||||
{
|
||||
$row = is_array($this->cObj->data ?? null) ? $this->cObj->data : null;
|
||||
$row = is_array($this->cObj?->data ?? null) ? $this->cObj->data : null;
|
||||
if ($row && (string)($row['CType'] ?? '') === 'vitec_usecaseshow') {
|
||||
return $this->renderForRecord($row);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user