Skip to main content
Version: 2023.1

Preview Scheduled Content

In Document preview tab Pimcore can provide a time slider to preview content at any given time. To take advantage of this feature for you custom implementations (e.g. custom controller actions), use the OutputTimestampResolver service and get the timestamp from it instead of using the current timestamp.

public function timestampAction(OutputTimestampResolver $outputTimestampResolver): Response
$currentTimestamp = $outputTimestampResolver->getOutputTimestamp();

$response = "
current time is " . date("Y-m-d H:i", $currentTimestamp) . "

return new Response($response);

Preview Scheduled ContentPreview Scheduled ContentPreview Scheduled Content

As soon as $outputTimestampResolver->getOutputTimestamp() is called somewhere, the time slider in document preview is shown. It is important, that the response is a valid html (with <head> and <body>), otherwise the time slider will not be shown.

The preview only can take content into acount that is already in the system and published. It cannot take scheduled versions of documents, assets or objects into account.

See also Scheduled Block for an editable that uses this functionality.