#105984Inconsistent backend preview renderer behavior
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.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Files 2
History 6
-
Rudolf Rohaczek changed subject
Wrong backend preview renderer behavior with pidInList definitionInconsistent backend preview renderer behavior 01/28/25, 06:06 -
Georg Ringer commented and changed status
NewNeeds Feedback 03/06/25, 21:48 -
Rudolf Rohaczek commented and changed attached staff.zip 03/21/25, 10:44
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.
-
Georg Ringer commented and changed attached Bildschirmfoto 2025-03-21 um 21.05.31.png status
Needs FeedbackRejected 03/21/25, 20:07Thanks 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_startingpointis a relation to the tablepagesand therefore the relation build in the preview is not to the staff table but of course topages. See the screenshotBildschirmfoto%202025-03-21%20um%2021.05.31.png
the curated plugin got a relation to
tx_staff_staffpeople_itemwhich of course works like expected.to solve this issue I suggest looking into
PageContentPreviewRenderingEventto solve the relation yourself and hand that into the preview. -
Rudolf Rohaczek commented 03/24/25, 08:49
The issue remains an inconsistency in the backend renderer behavior. The frontend correctly resolves records from
tx_staff_staffmember_itemusingpidInListwithtx_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.
UsingPageContentPreviewRenderingEventmight be a workaround, but that would indicate the backend preview rendering is incomplete rather than working as intended. -
Georg Ringer commented 03/24/25, 20:18
yes this is an inconsistency but only because you expect the same thing. I suggest to either show for
staff_storagethe selected pages or use an custom event to fetch those records.
can you share the TCA for the elements? or maybe an ext to reproduce that more easily, thanks!