Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Classes/ContentObject/WebcomponentContentObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ public function render($conf = []): string
$inputData->additionalData = $conf['additionalInputData.'];
}
$componentClassName = $contentObjectRenderer->stdWrapValue('component', $conf, null);
if (!is_string($componentClassName)) {
$this->logger->warning('No component class name provided', ['conf' => $conf, 'data' => $inputData->record]);
return '';
if (!empty($componentClassName)) {
try {
/** @var class-string<ComponentInterface> $componentClassName */
$componentRenderingData = $this->componentRenderer->evaluateComponent($inputData, $componentClassName, $contentObjectRenderer);
} catch (AssertionFailedException $e) {
$this->logger->warning('Component evaluation failed', ['conf' => $conf, 'data' => $inputData->record, 'exception' => $e]);
return $e->getRenderingPlaceholder();
}
} else {
$componentRenderingData = new ComponentRenderingData();
}

try {
/** @var class-string<ComponentInterface> $componentClassName */
$componentRenderingData = $this->componentRenderer->evaluateComponent($inputData, $componentClassName, $contentObjectRenderer);
} catch (AssertionFailedException $e) {
$this->logger->warning('Component evaluation failed', ['conf' => $conf, 'data' => $inputData->record, 'exception' => $e]);
return $e->getRenderingPlaceholder();
}
$componentRenderingData = $this->evaluateTypoScriptConfiguration($componentRenderingData, $conf);

$markup = $this->componentRenderer->renderComponent($componentRenderingData, $contentObjectRenderer);
Expand All @@ -78,7 +78,7 @@ private function evaluateTypoScriptConfiguration(ComponentRenderingData $compone
if (is_array($value)) {
continue;
}
$componentRenderingData = $componentRenderingData->withTagProperty($key, $this->cObj?->cObjGetSingle($value, $conf['properties.'][$key . '.']));
$componentRenderingData = $componentRenderingData->withTagProperty($key, $this->cObj?->stdWrap($value, $conf['properties.'][$key . '.'] ?? []));
}
}
$tagName = $this->cObj?->stdWrapValue('tagName', $conf);
Expand Down