‪TYPO3CMS  ‪main
TYPO3\CMS\Frontend\Middleware\PreviewSimulator Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Middleware\PreviewSimulator:

Public Member Functions

 __construct (protected readonly Context $context)
 
 process (ServerRequestInterface $request, RequestHandlerInterface $handler)
 

Protected Member Functions

 checkIfRootlineRequiresPreview (int $pageId)
 
 checkIfPageIsHidden (int $pageId, ServerRequestInterface $request)
 
 simulateDate (ServerRequestInterface $request)
 
 simulateUserGroup (ServerRequestInterface $request)
 

Detailed Description

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

Definition at line 41 of file PreviewSimulator.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Middleware\PreviewSimulator::__construct ( protected readonly Context  $context)

Definition at line 43 of file PreviewSimulator.php.

Member Function Documentation

◆ checkIfPageIsHidden()

TYPO3\CMS\Frontend\Middleware\PreviewSimulator::checkIfPageIsHidden ( int  $pageId,
ServerRequestInterface  $request 
)
protected

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

Definition at line 132 of file PreviewSimulator.php.

References TYPO3\CMS\Core\Context\LanguageAspectFactory\createFromSiteLanguage().

Referenced by TYPO3\CMS\Frontend\Middleware\PreviewSimulator\process().

◆ checkIfRootlineRequiresPreview()

TYPO3\CMS\Frontend\Middleware\PreviewSimulator::checkIfRootlineRequiresPreview ( int  $pageId)
protected

◆ process()

TYPO3\CMS\Frontend\Middleware\PreviewSimulator::process ( ServerRequestInterface  $request,
RequestHandlerInterface  $handler 
)

◆ simulateDate()

TYPO3\CMS\Frontend\Middleware\PreviewSimulator::simulateDate ( ServerRequestInterface  $request)
protected

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. 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.

Definition at line 160 of file PreviewSimulator.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Frontend\Middleware\PreviewSimulator\process().

◆ simulateUserGroup()

TYPO3\CMS\Frontend\Middleware\PreviewSimulator::simulateUserGroup ( ServerRequestInterface  $request)
protected

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. 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.

Definition at line 185 of file PreviewSimulator.php.

Referenced by TYPO3\CMS\Frontend\Middleware\PreviewSimulator\process().