.. include:: /Includes.rst.txt .. _feature-88921: =============================================================== Feature: #88921 - New PSR-14 events in the PageLayoutView class =============================================================== See :issue:`88921` Description =========== Two new PSR-14 events have been added to the :php:`PageLayoutView` class. Those events can be used to add content into any column of a BackendLayout. You can use this for example to show some content in a column without a ``colPos`` assigned. The event :php:`BeforeSectionMarkupGeneratedEvent` can be used to add content above the content elements of the column. The event :php:`AfterSectionMarkupGeneratedEvent` can be used to add content below the content elements of the column. You can use business logic to show content in specific columns. E.g. for displaying content only in columns without any ``colPos`` in the BackendLayout configuration. Example how to register the event listener in your own extension: :file:`EXT:my_extension/Configuration/Services.yaml` .. code-block:: yaml services: Vendor\MyExtension\Backend\View\PageLayoutViewDrawEmptyColposContent: tags: - name: event.listener identifier: 'myColposListener' before: 'backend-empty-colpos' event: TYPO3\CMS\Backend\View\Event\AfterSectionMarkupGeneratedEvent With :yaml:`before` and :yaml:`after`, you can make sure your own listener is executed before or after the given identifiers. :file:`EXT:my_extension/Classes/Backend/View/PageLayoutViewDrawEmptyColposContent.php` .. code-block:: php getColumnConfig()['colPos']) || trim($event->getColumnConfig()['colPos']) === '' ) { $content = $event->getContent(); $content .= <<
Empty colpos
This column has no "colPos". This is only for display Purposes.
EOD; $event->setStopRendering(true); $event->setContent($content); } } } With the :php:`$event->setStopRendering()` method, you can make sure that no other listeners are triggered after the current listener. .. index:: ext:backend, PHP-API