Attention
TYPO3 v12 has reached end-of-life as of April 30th 2026 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here: TYPO3 ELTS.
ModifyPageLayoutContentEvent
New in version 12.0
This event serves as a replacement for the removed hooks:
$GLOBALS['TYPO3_ CONF_ VARS'] ['SC_ OPTIONS'] ['cms/ layout/ db_ layout. php'] ['draw Header Hook'] $GLOBALS['TYPO3_ CONF_ VARS'] ['SC_ OPTIONS'] ['cms/ layout/ db_ layout. php'] ['draw Footer Hook']
The PSR-14 event
\TYPO3\
allows to modify page module content.
It is possible to add additional content, overwrite existing content or reorder the content.
Example
Registration of the event listener in the extension's Services.:
services:
# Place here the default dependency injection configuration
MyVendor\MyExtension\Backend\EventListener\MyEventListener:
tags:
- name: event.listener
identifier: 'my-extension/backend/modify-page-module-content'
Read how to configure dependency injection in extensions.
The corresponding event listener class:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Backend\EventListener;
use TYPO3\CMS\Backend\Controller\Event\ModifyPageLayoutContentEvent;
final class MyEventListener
{
public function __invoke(ModifyPageLayoutContentEvent $event): void
{
// Get the current page ID
$id = (int)($event->getRequest()->getQueryParams()['id'] ?? 0);
$event->addHeaderContent('Additional header content');
$event->setFooterContent('Overwrite footer content');
}
}
API
- class ModifyPageLayoutContentEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Backend\ Controller\ Event\ Modify Page Layout Content Event
Listeners to this Event will be able to modify the header and footer content of the page module
- setHeaderContent ( string $content)
-
Set content for the header. Can also be used to e.g. reorder existing content.
IMPORTANT: This overwrites existing content from previous listeners!
- param $content
-
the content
-
Set content for the footer. Can also be used to e.g. reorder existing content.
IMPORTANT: This overwrites existing content from previous listeners!
- param $content
-
the content
-
Add additional content to the footer
- param $content
-
the content
-
- Returns
-
string