Project

General

Profile

Actions

Bug #105984

closed

Inconsistent backend preview renderer behavior

Added by Rudolf Rohaczek 5 months ago. Updated 3 months ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2025-01-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

My project contains a content element where i can select starting points (system folders via TCA type group). With that data i collect records from the selected folders.

I created a content element that is using the database-query data processor:

tt_content.staffmembers_storage {
    # template setup is in another location
    dataProcessing {
        10 = database-query
        10 {
            as = staffmembers
            table = tx_staff_staffmember_item
            pidInList.field = tx_staff_startingpoint
            orderBy = sorting
            dataProcessing {
                10 = files
                10 {
                    references.fieldName = image
                    as = image
                }
            }
        }
    }
}

Then i created the following setup for the backend preview:

mod.web_layout {
    tt_content {
        preview {
            staffmembers_storage = EXT:staff/Resources/Private/Templates/Preview/StaffmembersStorage.html
        }
    }
}

The output in the frontend works without problems. I get the staffmembers records and can process them as expected.

In the backend preview template i also get data output and try to access the records but there are no usable items in the "record" object. There is data in tx_staff_startingpoint but this lists only the selected folders as items. There is no sight of the desired records.

What made me create this issue is the fact that i have nearly the same content element. In this case you can select individual records (TCA type group) in the content element. This is the setup:

tt_content.staffmembers_curated {
    dataProcessing {
        10 = database-query
        10 {
            as = staffmembers
            table = tx_staff_staffmember_item
            uidInList.field = tx_staff_staffmembers
            pidInList = 0
            orderBy = sorting
            dataProcessing {
                10 = files
                10 {
                    references.fieldName = image
                    as = image
                }
            }
        }
    }
}
mod.web_layout {
    tt_content {
        preview {
            staffmembers_curated = EXT:staff/Resources/Private/Templates/Preview/StaffmembersCurated.html
        }
    }
}

With that not only the frontend output works, but also the backend preview gets the requested records in the field tx_staff_staffmembers.

Conclusion:

So in my opinion the behavior of the backend preview renderer is inconsistent/wrong in the case of the pidInList definition. Also due the fact that the frontend output is working with my typoscript setup.


Files

staff.zip (26.1 KB) staff.zip Extension to show the described be preview problem Rudolf Rohaczek, 2025-03-21 10:39
Bildschirmfoto 2025-03-21 um 21.05.31.png (189 KB) Bildschirmfoto 2025-03-21 um 21.05.31.png Georg Ringer, 2025-03-21 20:05
Actions #1

Updated by Rudolf Rohaczek 5 months ago

  • Subject changed from Wrong backend preview renderer behavior with pidInList definition to Inconsistent backend preview renderer behavior
Actions #2

Updated by Georg Ringer 4 months ago

  • Status changed from New to Needs Feedback

can you share the TCA for the elements? or maybe an ext to reproduce that more easily, thanks!

Actions #3

Updated by Rudolf Rohaczek 3 months ago

Georg Ringer wrote in #note-2:

can you share the TCA for the elements? or maybe an ext to reproduce that more easily, thanks!

Yeah sure, attached is a small example extension. In the README you will find a guideline.

Actions #4

Updated by Georg Ringer 3 months ago

Thanks a lot for the extension. this was really helpful to understand the problem.

I am sorry but this is not a bug and can also not be solved by the core. tx_staff_startingpoint is a relation to the table pages and therefore the relation build in the preview is not to the staff table but of course to pages. See the screenshot

the curated plugin got a relation to tx_staff_staffpeople_item which of course works like expected.

to solve this issue I suggest looking into PageContentPreviewRenderingEvent to solve the relation yourself and hand that into the preview.

Actions #5

Updated by Rudolf Rohaczek 3 months ago

The issue remains an inconsistency in the backend renderer behavior. The frontend correctly resolves records from tx_staff_staffmember_item using pidInList with tx_staff_startingpoint , so the same should be expected in the backend preview.
If this is not considered a bug, then at least there is a discrepancy between frontend and backend behavior that should either be addressed in the core or documented properly.
Using PageContentPreviewRenderingEvent might be a workaround, but that would indicate the backend preview rendering is incomplete rather than working as intended.

Actions #6

Updated by Georg Ringer 3 months ago

yes this is an inconsistency but only because you expect the same thing. I suggest to either show for staff_storage the selected pages or use an custom event to fetch those records.

Actions

Also available in: Atom PDF