PreviewSimulator implements MiddlewareInterface

Middleware for handling preview settings used when simulating / previewing pages or content through query params when previewing access or time restricted content via for example backend preview links

Table of Contents

Interfaces

MiddlewareInterface

Properties

$context  : Context

Methods

__construct()  : mixed
process()  : ResponseInterface
Evaluates preview settings if a backend user is logged in
checkIfPageIsHidden()  : bool
Checks if the page is hidden in the active workspace + language setup.
checkIfRootlineRequiresPreview()  : bool
simulateDate()  : bool
Simulate dates for preview functionality When previewing a time restricted page from the backend, the parameter ADMCMD_simTime it added containing a timestamp with the time to preview. The globals 'SIM_EXEC_TIME' and 'SIM_ACCESS_TIME' and the 'DateTimeAspect' are used to simulate rendering at that point in time.
simulateUserGroup()  : bool
Simulate user group for preview functionality. When previewing a page with a user group restriction, the parameter ADMCMD_simUser = <groupId> will be added to the preview url. Simulation happens.

Properties

Methods

process()

Evaluates preview settings if a backend user is logged in

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

checkIfPageIsHidden()

Checks if the page is hidden in the active workspace + language setup.

protected checkIfPageIsHidden(int $pageId, ServerRequestInterface $request) : bool
Parameters
$pageId : int
$request : ServerRequestInterface
Return values
bool

checkIfRootlineRequiresPreview()

protected checkIfRootlineRequiresPreview(int $pageId) : bool
Parameters
$pageId : int
Return values
bool

simulateDate()

Simulate dates for preview functionality When previewing a time restricted page from the backend, the parameter ADMCMD_simTime it added containing a timestamp with the time to preview. The globals 'SIM_EXEC_TIME' and 'SIM_ACCESS_TIME' and the 'DateTimeAspect' are used to simulate rendering at that point in time.

protected simulateDate(ServerRequestInterface $request) : bool

Ideally the global access is removed in future versions. This functionality needs to be loaded after BackendAuthenticator as it is only relevant for logged in backend users and needs to be done before any page resolving starts.

Parameters
$request : ServerRequestInterface
Return values
bool

simulateUserGroup()

Simulate user group for preview functionality. When previewing a page with a user group restriction, the parameter ADMCMD_simUser = <groupId> will be added to the preview url. Simulation happens.

protected simulateUserGroup(ServerRequestInterface $request) : bool

This functionality needs to be loaded after BackendAuthenticator as it is only relevant for logged in backend users and needs to be done before any page resolving starts.

Parameters
$request : ServerRequestInterface
Return values
bool

        
On this page

Search results