From ead5357c97478ab2e983f080ac5e3ee924c7424d Mon Sep 17 00:00:00 2001 From: Justus Moroni Date: Wed, 3 Apr 2024 12:58:26 +0200 Subject: [PATCH] feat: Detect containers by searching the registry Before we checked if a CType contained a specific string to check if it is a container. This was open to false positives if a normal content element also contained this string. We now check the proper place to detect if a CType is registered as a container. Related: #6 --- Classes/Sizes/Rootline.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/Sizes/Rootline.php b/Classes/Sizes/Rootline.php index 5fe8967..cf5613a 100644 --- a/Classes/Sizes/Rootline.php +++ b/Classes/Sizes/Rootline.php @@ -23,6 +23,7 @@ * 02110-1301, USA. */ +use B13\Container\Tca\Registry; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; @@ -83,7 +84,10 @@ private function determineBackendLayout(): void private function determineContentElement(array $data): ContentElementInterface { - if (str_contains((string) $data['CType'], '_container-')) { + if ( + class_exists(Registry::class) + && GeneralUtility::makeInstance(Registry::class)->isContainerElement($data['CType']) + ) { return new Container($data); }