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
Methods
- __construct() : mixed
- process() : ResponseInterface
- Evaluates preview settings if a backend user is logged in
- 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 usergroup restriction, the parameter ADMCMD_simUser = <groupId> will be added to the preview url. Simulation happens.
Methods
__construct()
public
__construct(Context $context) : mixed
Parameters
- $context : Context
process()
Evaluates preview settings if a backend user is logged in
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Tags
Return values
ResponseInterfacesimulateDate()
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
boolsimulateUserGroup()
Simulate user group for preview functionality When previewing a page with a usergroup restriction, the parameter ADMCMD_simUser = <groupId> will be added to the preview url. Simulation happens.
protected
simulateUserGroup(ServerRequestInterface $request) : bool
legacy: via TSFE member variables (->fe_user->user[<groupColumn>]) new: via Context::UserAspect 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