Skip to content

Commit

Permalink
chore: harmonize spelling of
Browse files Browse the repository at this point in the history
  • Loading branch information
smichaelsen committed Mar 21, 2024
1 parent 6dad7d4 commit fd4c64c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
28 changes: 14 additions & 14 deletions Classes/ContentObject/WebcomponentContentObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,49 @@ class WebcomponentContentObject extends AbstractContentObject

public function render($conf = []): string
{
$webComponentRenderingData = GeneralUtility::makeInstance(WebcomponentRenderingData::class);
$webComponentRenderingData = $this->evaluateDataProvider($webComponentRenderingData, $conf['dataProvider'] ?? '', $this->cObj);
$webComponentRenderingData = $this->evaluateTypoScriptConfiguration($webComponentRenderingData, $conf);
$webcomponentRenderingData = GeneralUtility::makeInstance(WebcomponentRenderingData::class);
$webcomponentRenderingData = $this->evaluateDataProvider($webcomponentRenderingData, $conf['dataProvider'] ?? '', $this->cObj);
$webcomponentRenderingData = $this->evaluateTypoScriptConfiguration($webcomponentRenderingData, $conf);

$contentElementRecordData = $this->cObj->getCurrentTable() === 'tt_content' ? $this->cObj->data : [];
$event = GeneralUtility::makeInstance(WebComponentWillBeRendered::class, $webComponentRenderingData, $contentElementRecordData);
$event = GeneralUtility::makeInstance(WebComponentWillBeRendered::class, $webcomponentRenderingData, $contentElementRecordData);
$eventDispatcher = GeneralUtility::makeInstance(EventDispatcher::class);
$eventDispatcher->dispatch($event);

if (!$webComponentRenderingData->isRenderable()) {
if (!$webcomponentRenderingData->isRenderable()) {
return '';
}

// render with tag builder
$markup = $this->renderMarkup($webComponentRenderingData);
$markup = $this->renderMarkup($webcomponentRenderingData);

// apply stdWrap
$markup = $this->cObj->stdWrap($markup, $conf['stdWrap.'] ?? []);

return $markup;
}

private function evaluateTypoScriptConfiguration(WebcomponentRenderingData $webComponentRenderingData, array $conf): WebcomponentRenderingData
private function evaluateTypoScriptConfiguration(WebcomponentRenderingData $webcomponentRenderingData, array $conf): WebcomponentRenderingData
{
if (isset($conf['properties.'])) {
foreach ($conf['properties.'] as $key => $value) {
if (is_array($value)) {
continue;
}
$webComponentRenderingData->setProperty($key, $this->cObj->cObjGetSingle($value, $conf['properties.'][$key . '.']));
$webcomponentRenderingData->setProperty($key, $this->cObj->cObjGetSingle($value, $conf['properties.'][$key . '.']));
}
}
if (($conf['tagName'] ?? '') || ($conf['tagName.'] ?? [])) {
$webComponentRenderingData->setTagName($this->cObj->stdWrap($conf['tagName'] ?? '', $conf['tagName.'] ?? []) ?: null);
$webcomponentRenderingData->setTagName($this->cObj->stdWrap($conf['tagName'] ?? '', $conf['tagName.'] ?? []) ?: null);
}
return $webComponentRenderingData;
return $webcomponentRenderingData;
}

private function renderMarkup(WebcomponentRenderingData $webComponentRenderingData): string
private function renderMarkup(WebcomponentRenderingData $webcomponentRenderingData): string
{
$tagName = $webComponentRenderingData->getTagName();
$content = $webComponentRenderingData->getContent();
$properties = $webComponentRenderingData->getProperties();
$tagName = $webcomponentRenderingData->getTagName();
$content = $webcomponentRenderingData->getContent();
$properties = $webcomponentRenderingData->getProperties();

return $this->renderComponent($tagName, $content, $properties);
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/DataProvider/Traits/RenderComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ protected function renderComponent(string $tagName, ?string $content, array $pro
return $tagBuilder->render();
}

private function evaluateDataProvider(WebcomponentRenderingData $webComponentRenderingData, string $dataProviderClassName, ContentObjectRenderer $contentObjectRenderer): WebcomponentRenderingData
private function evaluateDataProvider(WebcomponentRenderingData $webcomponentRenderingData, string $dataProviderClassName, ContentObjectRenderer $contentObjectRenderer): WebcomponentRenderingData
{
if (empty($dataProviderClassName)) {
return $webComponentRenderingData;
return $webcomponentRenderingData;
}
$inputData = $contentObjectRenderer->data ?? [];
$dataProvider = GeneralUtility::makeInstance($dataProviderClassName);
if ($dataProvider instanceof DataProviderInterface) {
$dataProvider->setContentObjectRenderer($contentObjectRenderer);
$webComponentRenderingData = $dataProvider->provide($inputData, $webComponentRenderingData);
$webcomponentRenderingData = $dataProvider->provide($inputData, $webcomponentRenderingData);
}
return $webComponentRenderingData;
return $webcomponentRenderingData;
}
}
12 changes: 6 additions & 6 deletions Classes/DataProvider/Traits/RenderSubComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ protected function renderSubComponent(string $dataProviderClassName, $inputData
throw new \RuntimeException('DataProvider must implement DataProviderInterface');
}
$dataProvider->setContentObjectRenderer($this->contentObjectRenderer);
$webComponentRenderingData = GeneralUtility::makeInstance(WebcomponentRenderingData::class);
$webComponentRenderingData = $dataProvider->provide($inputData, $webComponentRenderingData);
$webcomponentRenderingData = GeneralUtility::makeInstance(WebcomponentRenderingData::class);
$webcomponentRenderingData = $dataProvider->provide($inputData, $webcomponentRenderingData);

if (!$webComponentRenderingData->isRenderable()) {
if (!$webcomponentRenderingData->isRenderable()) {
return null;
}

return $this->renderComponent(
$webComponentRenderingData->getTagName(),
$webComponentRenderingData->getContent(),
$webComponentRenderingData->getProperties()
$webcomponentRenderingData->getTagName(),
$webcomponentRenderingData->getContent(),
$webcomponentRenderingData->getProperties()
);
}
}

0 comments on commit fd4c64c

Please sign in to comment.