Issue Bug Rejected

#105984Inconsistent backend preview renderer behavior

Rudolf Rohaczek 01/23/25, 14:49 updated 03/24/25, 20:18

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

  1. Rudolf Rohaczek changed subject Wrong backend preview renderer behavior with pidInList definition Inconsistent backend preview renderer behavior 01/28/25, 06:06

  2. Georg Ringer commented and changed status New Needs Feedback 03/06/25, 21:48

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

  3. 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.

  4. Georg Ringer commented and changed attached Bildschirmfoto 2025-03-21 um 21.05.31.png status Needs Feedback Rejected 03/21/25, 20:07

    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

    Bildschirmfoto%202025-03-21%20um%2021.05.31.png

    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.

  5. 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_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.

  6. 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_storage the selected pages or use an custom event to fetch those records.