WorkspacePreview
final class \
- Implements
- MiddlewareInterface
- Uses
- CookieHeaderTrait
Middleware to - evaluate ADMCMD_prev as GET parameter or from a cookie - initializes the PreviewUser as $GLOBALS['BE_USER'] - renders a message about a possible workspace previewing currently
Internal
Table of Contents
Interfaces
- MiddlewareInterface
Constants
- LIVE_COMPARISON_ATTRIBUTE : string = 'workspaces.preview.liveComparison'
- Request attribute set when the live version is rendered for a backend user, which the frontend preview uses to compare records against (see FrontendPreviewChangeMarker)
Methods
- __construct() : mixed
- process() : ResponseInterface
- Initializes a possible preview user (by checking for GET/cookie of name "ADMCMD_prev")
- typoScriptDeterminedListener() : void
- This middleware is run pretty early in the FE chain to initialize correctly.
Constants
LIVE_COMPARISON_ATTRIBUTE
Request attribute set when the live version is rendered for a backend user, which the frontend preview uses to compare records against (see FrontendPreviewChangeMarker)
public
string
LIVE_COMPARISON_ATTRIBUTE
= 'workspaces.preview.liveComparison'
Internal
Methods
__construct()
public
__construct(Context $context, ConnectionPool $connectionPool, SystemResourceFactory $systemResourceFactory, SystemResourcePublisherInterface $systemResourcePublisher, RequestId $requestId) : mixed
Parameters
- $context : Context
- $connectionPool : ConnectionPool
- $systemResourceFactory : SystemResourceFactory
- $systemResourcePublisher : SystemResourcePublisherInterface
- $requestId : RequestId
process()
Initializes a possible preview user (by checking for GET/cookie of name "ADMCMD_prev")
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
The GET parameter "ADMCMD_prev=LIVE" can be used to preview a live workspace from the backend even if the backend user is in a different workspace.
Additionally, if a workspace is previewed, an additional message text is shown.
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterfacetypoScriptDeterminedListener()
This middleware is run pretty early in the FE chain to initialize correctly.
public
typoScriptDeterminedListener(AfterTypoScriptDeterminedEvent $event) : void
To render the preview information however, it depends on TypoScript 'config', which is not available in the incoming Request, yet. It thus listens on the AfterTypoScriptDeterminedEvent to determine its preview details.
Parameters
- $event : AfterTypoScriptDeterminedEvent
Attributes
- #[AsEventListener]
- 'typo3-workspaces/workspace-preview-middleware'