ModifyPageLayoutContentEvent 

The PSR-14 event \TYPO3\CMS\Backend\Controller\Event\ModifyPageLayoutContentEvent allows to modify page module content.

It is possible to add additional content, overwrite existing content or reorder the content.

Example 

EXT:my_extension/Classes/Backend/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Backend\EventListener;

use TYPO3\CMS\Backend\Controller\Event\ModifyPageLayoutContentEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(
  identifier: 'my-extension/backend/modify-page-module-content',
)]
final readonly 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');
  }
}
Copied!

API 

class ModifyPageLayoutContentEvent
Fully qualified name
\TYPO3\CMS\Backend\Controller\Event\ModifyPageLayoutContentEvent

Listeners to this Event will be able to modify the header and footer content of the page module

getRequest()
Returns
PsrHttpMessageServerRequestInterface
getModuleTemplate()
Returns
TYPO3CMSBackendTemplateModuleTemplate
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

addHeaderContent(string $content)

Add additional content to the header

param $content

the content

getHeaderContent()
Returns
string
setFooterContent(string $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

addFooterContent(string $content)

Add additional content to the footer

param $content

the content

getFooterContent()
Returns
string