BeforeLoadedPageTsConfigEvent¶
New in version 13.0
The PSR-14 event
\TYPO3\
can be used to add global static page TSconfig
before anything else is loaded. This is especially useful, if page TSconfig is
generated automatically as a string from a PHP function.
It is important to understand that this configuration is considered static and thus should not depend on runtime / request.
Example¶
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\TypoScript\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\TypoScript\IncludeTree\Event\BeforeLoadedPageTsConfigEvent;
#[AsEventListener(
identifier: 'my-extension/global-pagetsconfig',
)]
final readonly class MyEventListener
{
public function __invoke(BeforeLoadedPageTsConfigEvent $event): void
{
$event->addTsConfig('global = a global setting');
}
}
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¶
- class BeforeLoadedPageTsConfigEvent ¶
-
- Fully qualified name
-
\TYPO3\
CMS\ Core\ Typo Script\ Include Tree\ Event\ Before Loaded Page Ts Config Event
Extensions can add global page TSconfig right before they are loaded from other sources like the global page.tsconfig file.
Note: The added config should not depend on runtime / request. This is considered static config and thus should be identical on every request.
- getTsConfig ( ) ¶
-
- Returns
-
array
- addTsConfig ( string $tsConfig) ¶
-
- param $tsConfig
-
the tsConfig
- setTsConfig ( array $tsConfig) ¶
-
- param $tsConfig
-
the tsConfig