Project

General

Profile

Actions

Bug #100849

open

ContentContentObject::render has wrong condition

Added by David Bruchmann 12 months ago. Updated 5 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2023-05-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
TypoScript Extension Plugin ContentElement
Complexity:
Is Regression:
Sprint Focus:

Description

The method

TYPO3\CMS\Frontend\ContentObject::render()
has the condition
if (!($frontendController->recordRegister[$registerField] ?? false)) {
.
The code inside the condition therefore is executed if the register never has an entry yet with the key $registerField.
In some special cases though, this register is already existing, but without content, so the rendered output stays empty.
In my opinion the check is wrong here, rather should just be checked if the required variable $registerField exists with a value:
if ($registerField) {

So, what are the special cases where this existing condition fails?
Creating a simple plugin with own CType, and adding it as [typoscript]: CONTENT element with required render instructions.

plugin.tx_mysitepackage_hero = CONTENT
plugin.tx_mysitepackage_hero {
    table = tt_content
    select {
        where = AND {#CType}="tx_mysitepackage_hero" 
        orderBy = sorting desc
    }
    renderObj = COA
    renderObj {
        20 = TEXT
        20.stdWrap.field = header
        20.stdWrap.noTrimWrap =  |<h1>THIS IS MY RENDERED CONTENT HEADER: |</h1>|
    }
}

This element is not rendered but I'd expect it to.

Files

ContentContentObject.patch (832 Bytes) ContentContentObject.patch David Bruchmann, 2023-05-10 09:19
Actions

Also available in: Atom PDF