Skip to content

Commit

Permalink
[BUGFIX] Fix handling of drop-in templates
Browse files Browse the repository at this point in the history
Fixes a combined issue where template file paths would be wrong in BE
context and the pi_flexform field would not be shown in record editing,
for templates placed in the plug-and-play / drop-in directory.
  • Loading branch information
NamelessCoder committed Mar 19, 2024
1 parent 02565d8 commit 1d99b7e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Classes/Builder/ContentTypeBuilder.php
Expand Up @@ -234,6 +234,17 @@ public function registerContentType(
'CType',
$providerExtensionName
);

/** @var \Countable $fields */
$fields = $form->getFields();
if (count($fields) > 0) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'pi_flexform',
$provider->getContentObjectType(),
'after:header'
);
}
}

protected function addIcon(Form $form, string $contentType): string
Expand Down
Expand Up @@ -14,6 +14,7 @@
use FluidTYPO3\Flux\Utility\ExtensionConfigurationUtility;
use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
use Symfony\Component\Finder\Finder;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down Expand Up @@ -168,6 +169,9 @@ protected static function determineAbsolutePathForFilename(string $filename): st
if (strpos($filename, '://') !== false) {
return $filename;
}
return realpath($filename) ?: $filename;
if (strpos($filename, '/') === 0) {
return $filename;
}
return Environment::getPublicPath() . '/' . $filename;
}
}

0 comments on commit 1d99b7e

Please sign in to comment.