AfterTemplatesHaveBeenDeterminedEvent¶
New in version 12.0: This event is a substitution for the
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Core/TypoScript/TemplateService']['runThroughTemplatesPostProcessing']
hook.
The event \TYPO3\CMS\Core\TypoScript\IncludeTree\Event\AfterTemplatesHaveBeenDeterminedEvent
can be used
to manipulate sys_template
rows. The event receives the list of resolved
sys_template
rows and the \Psr\Http\Message\ServerRequestInterface
and allows manipulating the
sys_template
rows array.
The event is called in the code of the Template backend module, for example in the Template Analyzer, and in the frontend.
Extensions using the old hook that want to stay compatible with TYPO3 v11 and v12 can implement both the hook and the event.
Example¶
MyVendor\MyExtension\EventListener\MyAfterTemplatesHaveBeenDeterminedEventListener:
tags:
- name: event.listener
identifier: 'my-extension/typoscript/post-process-sys-templates'
The corresponding event listener class could look like this:
use TYPO3\CMS\Core\TypoScript\IncludeTree\Event\AfterTemplatesHaveBeenDeterminedEvent;
final class MyAfterTemplatesHaveBeenDeterminedEventListener
{
public function __invoke(AfterTemplatesHaveBeenDeterminedEvent $event): void
{
$rows = $event->getTemplateRows();
// do something
$event->setTemplateRows($rows);
}
}
API¶
- class TYPO3\CMS\Core\TypoScript\IncludeTree\Event\AfterTemplatesHaveBeenDeterminedEvent¶
A PSR-14 event fired when sys_template rows have been fetched.
This event is intended to add own rows based on given rows or site resolution.
- getRootline()¶
- Return type
array
- getRequest()¶
- Return type
Psr\Http\Message\ServerRequestInterface
- getSite()¶
Convenience method to directly retrieve the Site. May be null though!
- Return type
TYPO3\CMS\Core\Site\Entity\SiteInterface
- getTemplateRows()¶
- Return type
array
- setTemplateRows(array $templateRows)¶
- Parameters
$templateRows (
array
) -- the templateRows