#108930GridColumnItem::getRecordType() returns null instead of string for nested content elements in TYPO3 14
Description
When rendering the backend page layout with nested content elements (e.g., container elements with child elements like tabs), the method GridColumnItem::getRecordType() returns null instead of a string, causing a TypeError in TYPO3 14.
This is a regression from TYPO3 13.4.x where the same code works without issues.
The error occurs during the rendering of the backend preview when the system tries to get the content type label for nested elements.
Steps to Reproduce
Install TYPO3 14.2.dev
Install Content Blocks 2.0.5 (friendsoftypo3/content-blocks)
Create a container content element with nested child elements (e.g., tabs with tabs_item)
View the page module in the backend
Error occurs when trying to render the page layout preview
Expected Behavior
The backend page layout should render without errors, as it does in TYPO3 13.4.x.
Actual Behavior
Error Message:
TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem::getRecordType():
Return value must be of type string, null returned
Stack Trace (relevant part):
in /vendor/typo3/cms-backend/Classes/View/BackendLayout/Grid/GridColumnItem.php line 390
public function getRecordType(): string
{
return $this->record->getRecordType();
}
at TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem->getRecordType()
in /vendor/typo3/cms-backend/Classes/View/BackendLayout/Grid/GridColumnItem.php line 173
public function getContentTypeLabel(): string
{
if (($recordType = $this->getRecordType()) === ‘’) {
return ‘’;
}
…
}
Environment
TYPO3 Version: 14.2.dev (main branch)
PHP Version: 8.2+
Extension: friendsoftypo3/content-blocks 2.0.5
Works in: TYPO3 13.4.x
Related Changes
This issue might be related to: https://review.typo3.org/c/Packages/TYPO3.CMS/+/88519
The stricter type enforcement in TYPO3 14 causes the method to fail when getRecordType() returns null for nested content elements, whereas TYPO3 13 tolerated this behavior.
Possible Solution
The getRecordType() method in GridColumnItem should either:
Return an empty string instead of null when the record type cannot be determined
Handle null values gracefully before the strict type declaration
Additional Context
The issue was initially reported in the Content Blocks Slack channel, where the maintainer confirmed this appears to be a Core issue rather than a Content Blocks specific problem.