EnhanceStdWrapEvent
New in version 13.0
This event is one of the more powerful replacements for the removed hook
$GLOBALS
.
Listeners to the PSR-14 event
\TYPO3\
are able to
modify the stdWrap processing, enhancing the
functionality and manipulating the final result/content. This is the parent
event, which allows the corresponding listeners to be called on each step.
Child events:
- BeforeStdWrapFunctionsInitializedEvent
- AfterStdWrapFunctionsInitializedEvent
- BeforeStdWrapFunctionsExecutedEvent
- AfterStdWrapFunctionsExecutedEvent
All events provide the same functionality. The difference is only the execution
order in which they are called in the std
processing chain.
Example
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Frontend\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Frontend\ContentObject\Event\AfterStdWrapFunctionsExecutedEvent;
use TYPO3\CMS\Frontend\ContentObject\Event\AfterStdWrapFunctionsInitializedEvent;
use TYPO3\CMS\Frontend\ContentObject\Event\BeforeStdWrapFunctionsInitializedEvent;
use TYPO3\CMS\Frontend\ContentObject\Event\EnhanceStdWrapEvent;
#[AsEventListener(
identifier: 'my-extension/my-stdwrap-enhancement',
)]
final readonly class MyEventListener
{
public function __invoke(EnhanceStdWrapEvent $event): void
{
// listen to all events
}
#[AsEventListener(
identifier: 'my-extension/my-stdwrap-before-initialized',
)]
public function individualListener(BeforeStdWrapFunctionsInitializedEvent $event): void
{
// listen on BeforeStdWrapFunctionsInitializedEvent only
}
#[AsEventListener(
identifier: 'my-extension/my-stdwrap-after-initialized-executed',
)]
public function listenOnMultipleEvents(
AfterStdWrapFunctionsInitializedEvent|AfterStdWrapFunctionsExecutedEvent $event,
): void {
// Union type to listen to different events
}
}
New in version 13.0
The PHP attribute \TYPO3\
has been
introduced to tag a PHP class as an event listener. Alternatively, you can also
register an event listener via the Configuration/
file. Have
a look into the section Implementing an event listener in your extension.
API
- abstract class EnhanceStdWrapEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Frontend\ Content Object\ Event\ Enhance Std Wrap Event
Listeners to this Event are able to modify the stdWrap processing, enhancing the functionality and manipulating the final result / content. This is the parent Event, which allows the corresponding listeners to be called on each step, see child Events: