Issue Feature Closed

#100723Add additional information to the record using PageContentPreviewRenderingEvent

Jochen Roth 04/24/23, 09:48 updated 09/10/24, 04:50

Description

Im overriding a backend template using page.tsconfig and added two buttons. These buttons should show up depending on if a CE is in the basket or not.

templates.typo3/cms-backend.1682083422 = vendor/package-name:Resources/Private/TemplateOverrides

PageContentPreviewRenderingEventListener.php

    public function __invoke(PageContentPreviewRenderingEvent $event): void
    {
        $record = $event->getRecord();
        $item = $this->basketItem((string)$record['uid'], $event->getTable(), (int)$record['uid']);

############# SET ADDITIONAL INFORMATION FOR THE RECORD
        $record['inBasket'] = (int)$this->basket->contains($item);
        $event->setRecord($record);
    }

This does not work in Resources/Private/Partials/PageLayout/Record.html when {item.record.inBasket} is used before {item.preview}.

Current workaround:

<f:variable name="triggerPageContentPreviewRenderingEventListener">{item.preview}</f:variable>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 6

  1. Jochen Roth changed Related to #99026 04/24/23, 09:48

  2. Jochen Roth changed description 04/24/23, 09:56

  3. Jochen Roth commented and changed tracker Bug Feature TYPO3 Version 12 04/25/23, 07:33

    Talked to @oli, maybe a additional event could do the job. Because the current event used PageContentPreviewRenderingEventListener does its job: preview rendering.

  4. Benni Mack changed target version 06/05/23, 09:23

  5. Jochen Roth commented 09/09/24, 16:42

    Double-checked in latest main. It’s working now.

  6. Benni Mack changed status New Closed 09/10/24, 04:50