Skip to content

Commit

Permalink
[BUGFIX] Fix content type registration for record-based CTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessCoder committed Oct 24, 2022
1 parent bf6ae95 commit 851e24e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
10 changes: 3 additions & 7 deletions Classes/Content/ContentTypeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ContentTypeManager implements SingletonInterface
const CACHE_TAG = 'content_types';

/**
* @var ContentTypeDefinitionInterface[]
* @var ContentTypeDefinitionInterface[]|null[]
*/
protected $types = [];

Expand Down Expand Up @@ -83,11 +83,7 @@ public function registerTypeDefinition(ContentTypeDefinitionInterface $typeDefin

public function determineContentTypeForTypeString(string $contentTypeName): ?ContentTypeDefinitionInterface
{
$definition = $this->loadSingleDefinitionFromCache($contentTypeName);
if ($definition === null) {
return null;
}
return $this->types[$contentTypeName] ?? ($this->types[$contentTypeName] = $definition);
return $this->types[$contentTypeName] ?? ($this->types[$contentTypeName] = $this->loadSingleDefinitionFromCache($contentTypeName));
}

public function determineContentTypeForRecord(array $record): ?ContentTypeDefinitionInterface
Expand All @@ -99,7 +95,7 @@ protected function loadSingleDefinitionFromCache(string $name): ?ContentTypeDefi
{
try {
/** @var ContentTypeDefinitionInterface|null $fromCache */
$fromCache = $this->getCache()->get(static::CACHE_IDENTIFIER_PREFIX . $name);
$fromCache = $this->getCache()->get(static::CACHE_IDENTIFIER_PREFIX . $name) ?: null;
return $fromCache;
} catch (NoSuchCacheException $error) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Integration/ContentTypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ protected function addIcon(Form $form, string $contentType): string
return $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$contentType];
}
$icon = MiscellaneousUtility::getIconForTemplate($form);
if ($icon !== null) {
if (!empty($icon)) {
if (strpos($icon, 'EXT:') === 0 || $icon[0] !== '/') {
$icon = GeneralUtility::getFileAbsFileName($icon);
}
Expand Down
10 changes: 5 additions & 5 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
]
);

// Initialize the TCA needed by "template as CType" integrations
\FluidTYPO3\Flux\Integration\HookSubscribers\TableConfigurationPostProcessor::spoolQueuedContentTypeTableConfigurations(
\FluidTYPO3\Flux\Core::getQueuedContentTypeRegistrations()
);

$GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['itemsProcFunc'] =
\FluidTYPO3\Flux\Integration\Overrides\BackendLayoutView::class . '->colPosListItemProcFunc';
$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['label'] = 'LLL:EXT:flux/Resources/Private/Language/locallang.xlf:tt_content.pi_flexform';
Expand All @@ -48,3 +43,8 @@
$contentType->getProviderClassName()
);
}

// Initialize the TCA needed by "template as CType" integrations
\FluidTYPO3\Flux\Integration\HookSubscribers\TableConfigurationPostProcessor::spoolQueuedContentTypeTableConfigurations(
\FluidTYPO3\Flux\Core::getQueuedContentTypeRegistrations()
);

0 comments on commit 851e24e

Please sign in to comment.