BeforeSectionMarkupGeneratedEvent

The PSR-14 event \TYPO3\CMS\Backend\View\Event\BeforeSectionMarkupGeneratedEvent allows extension authors to display content in any colPos before the first content element.

Example

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

declare(strict_types=1);

namespace MyVendor\MyExtension\Backend\EventListener;

use TYPO3\CMS\Backend\View\Event\BeforeSectionMarkupGeneratedEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(
    identifier: 'my-extension/before-section-markup-generated',
)]
final readonly class MyEventListener
{
    public function __invoke(BeforeSectionMarkupGeneratedEvent $event): void
    {
        // Check for relevant backend layout
        if ($event->getPageLayoutContext()->getBackendLayout()->getIdentifier() !== 'someBackendLayout') {
            return;
        }

        // Check for relevant column
        if ($event->getColumnConfig()['identifier'] !== 'someColumn') {
            return;
        }

        $event->setContent('
            <div class="t3-page-ce">
                <div class="t3-page-ce-element">
                    <div class="t3-page-ce-header">
                        <div class="t3-page-ce-header-title">
                            Some content at the start of the column
                        </div>
                    </div>
                </div>
            </div>
        ');
    }
}
Copied!

New in version 13.0

The PHP attribute \TYPO3\CMS\Core\Attribute\AsEventListener has been introduced to tag a PHP class as an event listener. Alternatively, or if you need to be compatible with older TYPO3 versions, you can also register an event listener via the Configuration/Services.yaml file. Switch to an older version of this page for an example or have a look at the section Implementing an event listener in your extension.

API

class BeforeSectionMarkupGeneratedEvent
Fully qualified name
\TYPO3\CMS\Backend\View\Event\BeforeSectionMarkupGeneratedEvent

This event can be triggered to display content in any colPos before the first content element.

getColumnConfig ( )
Returns
array
getPageLayoutContext ( )
Returns
\TYPO3\CMS\Backend\View\PageLayoutContext
getRecords ( )
Returns
array
setContent ( string $content = '')
param $content

the content, default: ''

getContent ( )
Returns
string
isPropagationStopped ( )

Prevent other listeners from being called if rendering is stopped by listener.

Returns
bool
setStopRendering ( bool $stopRendering)
param $stopRendering

the stopRendering