PreviewUriBuilder
Create links to pages when in a workspace for previewing purposes
Table of Contents
Properties
- $eventDispatcher : EventDispatcherInterface
- $pageCache : array<string|int, mixed>
- $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<string|int, mixed>
- 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<string|int, mixed>
- 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
$pageCache
protected
array<string|int, mixed>
$pageCache
= []
$previewLinkLifetime
protected
int
$previewLinkLifetime
$workspaceService
protected
WorkspaceService
$workspaceService
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<string|int, mixed> $liveRecord = null ][, array<string|int, mixed> $versionRecord = null ]) : string
Parameters
- $table : string
-
Table to be used
- $uid : int
-
Uid of the version(!) record
- $liveRecord : array<string|int, mixed> = null
-
Optional live record data
- $versionRecord : array<string|int, mixed> = null
-
Optional version record data
Return values
stringbuildUriForPage()
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
Return values
UriInterfacebuildUrisForAllLanguagesOfPage()
Generate workspace preview links for all available languages of a page
public
buildUrisForAllLanguagesOfPage(int $pageId) : array<string|int, mixed>
Parameters
- $pageId : int
Return values
array<string|int, mixed>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<string|int, mixed>|null $liveRecord = null ][, array<string|int, mixed>|null $versionRecord = null ]) : UriInterface|null
Parameters
- $table : string
- $uid : int
- $liveRecord : array<string|int, mixed>|null = null
- $versionRecord : array<string|int, mixed>|null = null
Return values
UriInterface|nullgetAvailableLanguages()
Get the available languages of a certain page, including language=0 if the user has access to it.
protected
getAvailableLanguages(int $pageId) : array<string|int, mixed>
Parameters
- $pageId : int
Return values
array<string|int, mixed> —assoc array with the languageId as key and the languageTitle as value
getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetLivePageUid()
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