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

Public Member Functions

 __construct (EventDispatcherInterface $eventDispatcher, WorkspaceService $workspaceService)
 
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

 createPreviewUriForElement (string $table, int $uid, ?array $liveRecord=null, ?array $versionRecord=null)
 
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
 
EventDispatcherInterface $eventDispatcher
 
int $previewLinkLifetime
 

Detailed Description

Create links to pages when in a workspace for previewing purposes

Definition at line 45 of file PreviewUriBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::__construct ( EventDispatcherInterface  $eventDispatcher,
WorkspaceService  $workspaceService 
)

Member Function Documentation

◆ buildUriForElement()

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

Generates a view URI for an element.

Parameters
string$table‪Table to be used
int$uid‪Uid of the version(!) record
array$liveRecord‪Optional live record data
array$versionRecord‪Optional version record data
Returns
‪string

Definition at line 147 of file PreviewUriBuilder.php.

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

◆ 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 77 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 124 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 105 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 220 of file PreviewUriBuilder.php.

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

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

◆ createPreviewUriForElement()

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

◆ 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 267 of file PreviewUriBuilder.php.

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

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

◆ getBackendUser()

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

Definition at line 309 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 248 of file PreviewUriBuilder.php.

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

Member Data Documentation

◆ $eventDispatcher

EventDispatcherInterface TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder::$eventDispatcher
protected

◆ $pageCache

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

Definition at line 49 of file PreviewUriBuilder.php.

◆ $previewLinkLifetime

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

Definition at line 61 of file PreviewUriBuilder.php.

◆ $workspaceService

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