PreviewUriBuilder
Create links to pages when in a workspace for previewing purposes
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
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 uid and runtime cache the result to avoid too many database-queries.
- getPreviewLinkLifetime() : int
- Determine the number of hours a preview link should be valid after creation, default 48 hours.
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher, FrontendInterface $runtimeCache, SiteFinder $siteFinder, UriBuilder $uriBuilder, ConnectionPool $connectionPool, TranslationConfigurationProvider $translationConfigurationProvider, TcaSchemaFactory $tcaSchemaFactory) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $runtimeCache : FrontendInterface
- $siteFinder : SiteFinder
- $uriBuilder : UriBuilder
- $connectionPool : ConnectionPool
- $translationConfigurationProvider : TranslationConfigurationProvider
- $tcaSchemaFactory : TcaSchemaFactory
buildUriForElement()
Generates a view URI for an element.
public
buildUriForElement(string $table, int $uid[, array<string|int, mixed>|null $liveRecord = null ][, array<string|int, mixed>|null $versionRecord = null ]) : string
Parameters
- $table : string
-
Table to be used
- $uid : int
-
Uid of the version(!) record
- $liveRecord : array<string|int, mixed>|null = null
- $versionRecord : array<string|int, mixed>|null = null
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() : string
Cached in runtime cache to only create one link per request, even if the service method is called multiple times.
Return values
string —Returns a 32 byte MD5 hash keyword for use in URL for 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 uid and runtime cache the result to avoid too many database-queries.
protected
getLivePageUid(int $uid) : int
Parameters
- $uid : int
Return values
intgetPreviewLinkLifetime()
Determine the number of hours a preview link should be valid after creation, default 48 hours.
protected
getPreviewLinkLifetime() : int