‪TYPO3CMS  10.4
TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder Class Reference

Public Member Functions

 __construct ()
 
string buildUriForPage (int $uid, int $languageId=0)
 
array buildUrisForAllLanguagesOfPage (int $pageId)
 
UriInterface buildUriForWorkspaceSplitPreview (int $uid)
 
string buildUriForElement (string $table, int $uid, array $liveRecord=null, array $versionRecord=null)
 

Protected Member Functions

string compilePreviewKeyword (int $ttl=172800, int $workspaceId=null)
 
int getLivePageUid (int $uid)
 
array getAvailableLanguages (int $pageId)
 
BackendUserAuthentication getBackendUser ()
 

Protected Attributes

array $pageCache = array( )
 
WorkspaceService $workspaceService
 
int $previewLinkLifetime
 

Detailed Description

Create links to pages when in a workspace for previewing purposes

Definition at line 42 of file PreviewUriBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::__construct ( )

Definition at line 56 of file PreviewUriBuilder.php.

Member Function Documentation

◆ buildUriForElement()

string TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::buildUriForElement ( string  $table,
int  $uid,
array  $liveRecord = null,
array  $versionRecord = null 
)

◆ buildUriForPage()

string TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::buildUriForPage ( int  $uid,
int  $languageId = 0 
)

Generates a workspace preview link.

Parameters
int$uid‪The ID of the record to be linked
int$languageId‪the language to link to
Returns
‪string the full domain including the protocol http:// or https://, but without the trailing '/'

Definition at line 69 of file PreviewUriBuilder.php.

References TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\compilePreviewKeyword().

Referenced by TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\buildUrisForAllLanguagesOfPage().

◆ buildUriForWorkspaceSplitPreview()

UriInterface TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::buildUriForWorkspaceSplitPreview ( int  $uid)

Generates a workspace split-bar preview link.

Parameters
int$uid‪The ID of the record to be linked
Returns
‪UriInterface
Exceptions

Definition at line 116 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\UriBuilder\ABSOLUTE_URL, and TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\getLivePageUid().

◆ buildUrisForAllLanguagesOfPage()

array TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::buildUrisForAllLanguagesOfPage ( int  $pageId)

Generate workspace preview links for all available languages of a page

Parameters
int$pageId
Returns
‪array

Definition at line 97 of file PreviewUriBuilder.php.

References TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\buildUriForPage(), and TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\getAvailableLanguages().

◆ compilePreviewKeyword()

string TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::compilePreviewKeyword ( int  $ttl = 172800,
int  $workspaceId = null 
)
protected

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

Parameters
int$ttl‪Time-To-Live for keyword
int | null$workspaceId‪Which workspace ID to preview.
Returns
‪string Returns keyword to use in URL for ADMCMD_prev=, a 32 byte MD5 hash keyword for the URL: "?ADMCMD_prev=[keyword]

Definition at line 212 of file PreviewUriBuilder.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\StringUtility\getUniqueId().

Referenced by TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\buildUriForPage().

◆ getAvailableLanguages()

array TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::getAvailableLanguages ( int  $pageId)
protected

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

Parameters
int$pageId
Returns
‪array assoc array with the languageId as key and the languageTitle as value

Definition at line 259 of file PreviewUriBuilder.php.

References $GLOBALS, TYPO3\CMS\Core\Authentication\BackendUserAuthentication\checkLanguageAccess(), and TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\getBackendUser().

Referenced by TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\buildUrisForAllLanguagesOfPage().

◆ getBackendUser()

BackendUserAuthentication TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::getBackendUser ( )
protected
Returns
‪BackendUserAuthentication

Definition at line 301 of file PreviewUriBuilder.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\getAvailableLanguages().

◆ getLivePageUid()

int TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::getLivePageUid ( int  $uid)
protected

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

Exceptions

Definition at line 240 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getRecord().

Referenced by TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\buildUriForWorkspaceSplitPreview().

Member Data Documentation

◆ $pageCache

array TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::$pageCache = array( )
protected

Definition at line 46 of file PreviewUriBuilder.php.

◆ $previewLinkLifetime

int TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::$previewLinkLifetime
protected

Definition at line 54 of file PreviewUriBuilder.php.

◆ $workspaceService

WorkspaceService TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::$workspaceService
protected

Definition at line 50 of file PreviewUriBuilder.php.