Feature: #102581 - PSR-14 event for modifying ContentObjectRenderer

See forge#102581


A new PSR-14 event \TYPO3\CMS\Frontend\ContentObject\Event\AfterContentObjectRendererInitializedEvent has been introduced which serves as a drop-in replacement for the now removed hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'].

The event is being dispatched after ContentObjectRenderer has been initialized in its start() method. The ContentObjectRenderer instance can be accessed using the getContentObjectRenderer() method.


The event listener class, using the PHP attribute #[AsEventListener] for registration:

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Frontend\ContentObject\Event\AfterContentObjectRendererInitializedEvent;

final class AfterContentObjectRendererInitializedEventListener
    public function __invoke(AfterContentObjectRendererInitializedEvent $event): void
        $event->getContentObjectRenderer()->setCurrentVal('My current value');


Using the new PSR-14 event, it's now possible to modify the ContentObjectRenderer instance, after it has been initialized.