PageContentErrorHandler implements PageErrorHandlerInterface

Renders the content of a page to be displayed (also in relation to language etc) This is typically configured via the "Sites configuration" module in the backend.

Table of Contents

Interfaces

PageErrorHandlerInterface
Page error handler interface, used to jump in for Frontend-related calls

Properties

$application  : Application
$errorHandlerConfiguration  : array<string|int, mixed>
$guzzleClientFactory  : GuzzleClientFactory
$link  : LinkService
$pageUid  : int
$requestFactory  : RequestFactoryInterface
$responseFactory  : ResponseFactoryInterface
$siteFinder  : SiteFinder
$statusCode  : int

Methods

__construct()  : mixed
PageContentErrorHandler constructor.
handlePageError()  : ResponseInterface
resolveUrl()  : string
Resolve the URL (currently only page and external URL are supported)
sendExternalRequest()  : ResponseInterface
Sends an external request to fetch the error page from a remote resource.
sendSubRequest()  : ResponseInterface
Sends an in-process subrequest.
stashEnvironment()  : ResponseInterface
Stash and restore portions of the global environment around a subrequest callable.

Properties

$errorHandlerConfiguration

protected array<string|int, mixed> $errorHandlerConfiguration

$requestFactory

protected RequestFactoryInterface $requestFactory

$responseFactory

protected ResponseFactoryInterface $responseFactory

Methods

__construct()

PageContentErrorHandler constructor.

public __construct(int $statusCode, array<string|int, mixed> $configuration) : mixed
Parameters
$statusCode : int
$configuration : array<string|int, mixed>
Tags
throws
InvalidArgumentException

handlePageError()

public handlePageError(ServerRequestInterface $request, string $message[, array<string|int, mixed> $reasons = [] ]) : ResponseInterface
Parameters
$request : ServerRequestInterface
$message : string
$reasons : array<string|int, mixed> = []
Return values
ResponseInterface

resolveUrl()

Resolve the URL (currently only page and external URL are supported)

protected resolveUrl(ServerRequestInterface $request, array<string|int, mixed> $urlParams) : string
Parameters
$request : ServerRequestInterface
$urlParams : array<string|int, mixed>
Return values
string

sendExternalRequest()

Sends an external request to fetch the error page from a remote resource.

protected sendExternalRequest(string $url, ServerRequestInterface $originalRequest) : ResponseInterface

A custom header is added and checked to mitigate request loops, which indicates additional configuration error in the error handler config.

Parameters
$url : string
$originalRequest : ServerRequestInterface
Return values
ResponseInterface

sendSubRequest()

Sends an in-process subrequest.

protected sendSubRequest(ServerRequestInterface $request, int $pageId, ServerRequestInterface $originalRequest) : ResponseInterface

The $pageId is used to ensure the correct site is accessed.

Parameters
$request : ServerRequestInterface
$pageId : int
$originalRequest : ServerRequestInterface
Return values
ResponseInterface

stashEnvironment()

Stash and restore portions of the global environment around a subrequest callable.

protected stashEnvironment(callable $fetcher) : ResponseInterface
Parameters
$fetcher : callable
Return values
ResponseInterface

        
On this page

Search results