PreviewUriBuilder

class \TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder

Create links to pages when in a workspace for previewing purposes

Table of Contents

Properties

$eventDispatcher  : EventDispatcherInterface
$pageCache  : array
$previewLinkLifetime  : int
$workspaceService  : WorkspaceService

Methods

__construct()  : mixed
buildUriForElement()  : string
Generates a view URI for an element.
buildUriForPage()  : string
Generates a workspace preview link.
buildUriForWorkspaceSplitPreview()  : UriInterface
Generates a workspace split-bar preview link.
buildUrisForAllLanguagesOfPage()  : array
Generate workspace preview links for all available languages of a page
compilePreviewKeyword()  : string
Adds an entry to the sys_preview database table and return the preview keyword.
createPreviewUriForElement()  : UriInterface|null
getAvailableLanguages()  : array
Get the available languages of a certain page, including language=0 if the user has access to it.
getBackendUser()  : BackendUserAuthentication
getLivePageUid()  : int
Find the Live-Uid for a given page, the results are cached at run-time to avoid too many database-queries

Properties

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$previewLinkLifetime

protected int $previewLinkLifetime

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher, WorkspaceService $workspaceService) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface
$workspaceService : WorkspaceService

buildUriForElement()

Generates a view URI for an element.

public buildUriForElement(string $table, int $uid[, array $liveRecord = null ][, array $versionRecord = null ]) : string

Parameters

$table : string

Table to be used

$uid : int

Uid of the version(!) record

$liveRecord : array = null

Optional live record data

$versionRecord : array = null

Optional version record data

Return values

string

buildUriForPage()

Generates a workspace preview link.

public buildUriForPage(int $uid[, int $languageId = 0 ]) : string

Parameters

$uid : int

The ID of the record to be linked

$languageId : int = 0

the language to link to

Return values

string —

the full domain including the protocol http:// or https://, but without the trailing '/'

buildUriForWorkspaceSplitPreview()

Generates a workspace split-bar preview link.

public buildUriForWorkspaceSplitPreview(int $uid) : UriInterface

Parameters

$uid : int

The ID of the record to be linked

Tags

throws
RouteNotFoundException

Return values

UriInterface

buildUrisForAllLanguagesOfPage()

Generate workspace preview links for all available languages of a page

public buildUrisForAllLanguagesOfPage(int $pageId) : array

Parameters

$pageId : int

Return values

array

compilePreviewKeyword()

Adds an entry to the sys_preview database table and return the preview keyword.

protected compilePreviewKeyword([int $ttl = 172800 ][, int|null $workspaceId = null ]) : string

Parameters

$ttl : int = 172800

Time-To-Live for keyword

$workspaceId : int|null = null

Which workspace ID to preview.

Return values

string —

Returns keyword to use in URL for ADMCMD_prev=, a 32 byte MD5 hash keyword for the URL: "?ADMCMD_prev=[keyword]

createPreviewUriForElement()

protected createPreviewUriForElement(string $table, int $uid[, array|null $liveRecord = null ][, array|null $versionRecord = null ]) : UriInterface|null

Parameters

$table : string
$uid : int
$liveRecord : array|null = null
$versionRecord : array|null = null

Return values

UriInterface|null

getAvailableLanguages()

Get the available languages of a certain page, including language=0 if the user has access to it.

protected getAvailableLanguages(int $pageId) : array

Parameters

$pageId : int

Return values

array —

assoc array with the languageId as key and the languageTitle as value

getLivePageUid()

Find the Live-Uid for a given page, the results are cached at run-time to avoid too many database-queries

protected getLivePageUid(int $uid) : int

Parameters

$uid : int

Tags

throws
InvalidArgumentException

Return values

int
On this page