Issue Feature Under Review Stale

#110434PSR-14 event to add content around the record edit form

Konrad Michalik 08/11/26, 10:17 updated 09/17/26, 14:47

Description

The page module provides `ModifyPageLayoutContentEvent` to render additional content above and below the module body. The record list provides `RenderAdditionalContentToRecordListEvent` for the same purpose. There is no equivalent for the record edit form rendered by `EditDocumentController`.

`EditDocumentController` already dispatches three events (`BeforeFormEnginePageInitializedEvent`, `AfterFormEnginePageInitializedEvent`, `AfterRecordOpenedEvent`), but none of them allows rendering markup around the form. Extensions therefore fall back to a middleware that rewrites the response body, which is fragile and breaks on markup changes.

Use case: EXT:xima_typo3_content_planner shows an editorial status bar above the edit form. It currently does this via a response-manipulating middleware, while the same information is rendered through the proper event API in the page module and the record list.

https://docs.typo3.org/p/xima/xima-typo3-content-planner/main/en-us/Usage/StatusChange.html#edit-form

Proposal: a new PSR-14 event, e.g. `ModifyEditDocumentContentEvent`, dispatched in `EditDocumentController::mainAction()` right before the body is assigned to the view. Scope intentionally narrow, mirroring `ModifyPageLayoutContentEvent`:

- header content, rendered above the form
- footer content, rendered below the form
- read access to the request and the `ModuleTemplate`

No interference with FormEngine internals, no access to the form result.

I am willing to provide the patch.

Reviews 1

History 25

  1. Konrad Michalik commented <span data-processor="relativetime" data-value="2026-08-12T10:40:17+00:00" > 08/12/26, 10:40 </span>

    Patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/95278

    Two things turned out differently from the proposal above while implementing it.

    Naming: the event is called BeforeRecordEditFormIsRenderedEvent instead of ModifyEditDocumentContentEvent , following the BeforeXxx / AfterXxx scheme that is preferred for new events. The name is deliberately controller-neutral, which leads to the second point.

    Two dispatch points: the event is dispatched from both EditDocumentController and ContextualRecordEditController . Since 14.3 the contextual controller is the path taken when a record is edited from the page module, contextual-record-edit-trigger.ts opens record_edit_contextual in a sheet and only falls back to record_edit when the user setting contextualRecordEdit is disabled. An event in EditDocumentController alone would therefore have missed the main editing path, and it would not have replaced response manipulation either: a middleware matching on the edit query parameter hits both routes today.

    Listeners that want to distinguish the two can read the route identifier:

    $routeIdentifier = $event->getRequest()->getAttribute('route')?->getOption('_identifier');

    Narrower API than proposed: the event exposes only getRequest() , no ModuleTemplate . ContextualRecordEdit.fluid.html does not use the module layout and renders its own header, so doc header modifications would silently have no effect there and the API would behave differently depending on the route. For doc header buttons ModifyButtonBarEvent is the right place. This makes the event identical in shape to RenderAdditionalContentToRecordListEvent . Adding ModuleTemplate later is possible, removing it would not be.

    Both routes are covered by functional tests, a changelog entry is included.