Project

General

Profile

Actions

Feature #100723

closed

Add additional information to the record using PageContentPreviewRenderingEvent

Added by Jochen Roth over 1 year ago. Updated 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Start date:
2023-04-24
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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>


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99026: Change Record Data in PageContentPreviewRenderingEventClosed2022-11-09

Actions
Actions #1

Updated by Jochen Roth over 1 year ago

  • Related to Bug #99026: Change Record Data in PageContentPreviewRenderingEvent added
Actions #2

Updated by Jochen Roth over 1 year ago

  • Description updated (diff)
Actions #3

Updated by Jochen Roth over 1 year ago

  • Tracker changed from Bug to Feature
  • TYPO3 Version deleted (12)

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

Actions #4

Updated by Benni Mack over 1 year ago

  • Target version changed from 12 LTS to Candidate for patchlevel
Actions #5

Updated by Jochen Roth 2 months ago

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

Actions #6

Updated by Benni Mack 2 months ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF