PageContextInitialization implements MiddlewareInterface, LoggerAwareInterface uses LoggerAwareTrait

Initializes PageContext for backend modules that work with pages.

Creates a PageContext with resolved language information and stores it in the request attribute 'pageContext' for use by controllers.

This middleware only runs for modules that use the page tree navigation component ('@typo3/backend/tree/page-tree-element'). This includes modules like web_layout, web_list, and others under the 'content' parent, as well as standalone modules that explicitly set the navigation component.

The middleware:

  • Checks if the module or any of its parents use the page tree component
  • Extracts the page ID from request (query or body parameter 'id')
  • Defaults to page ID 0 (NullSite/root level) if not found
  • Creates PageContext with language resolution

If PageContext creation fails (e.g. no site found, no page access), the middleware logs a warning but continues without breaking the request, allowing controllers to handle the missing context or create it manually.

Internal

Table of Contents

Interfaces

MiddlewareInterface
LoggerAwareInterface

Properties

$pageContextFactory  : PageContextFactory

Methods

__construct()  : mixed
process()  : ResponseInterface

Properties

Methods

process()

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Return values
ResponseInterface

        
On this page

Search results