‪TYPO3CMS  11.5
TYPO3\CMS\Backend\Routing\PreviewUriBuilder Class Reference

Public Member Functions

 __construct (int $pageId, ?string $alternativeUri=null)
 
Uri null buildUri (?array $options=null)
 
array null buildDispatcherDataAttributes (?array $options=null)
 
array null buildDispatcherAttributes (?array $options=null)
 
string null serializeDispatcherAttributes (?array $options=null)
 
string null buildImmediateActionElement (?array $options=null)
 

Static Public Member Functions

static static create (int $pageId, ?string $alternativeUri=null)
 
static withModuleLoading (bool $moduleLoading)
 
static withRootLine (array $rootLine)
 
static withSection (string $section)
 
static withAdditionalQueryParameters (string $additionalQueryParameters)
 

Public Attributes

const OPTION_SWITCH_FOCUS = 'switchFocus'
 
const OPTION_WINDOW_NAME = 'windowName'
 
const OPTION_WINDOW_FEATURES = 'windowFeatures'
 
const OPTION_WINDOW_SCOPE = 'windowScope'
 
const OPTION_WINDOW_SCOPE_LOCAL = 'local'
 
const OPTION_WINDOW_SCOPE_GLOBAL = 'global'
 

Protected Member Functions

 buildAttributes (?array $options=null)
 
array enrichOptions (?array $options=null)
 
 loadActionDispatcher ()
 
 loadImmediateActionElement ()
 
 prefixAttributeNames (string $prefix, array $attributes)
 

Protected Attributes

int $pageId
 
string null $alternativeUri
 
array null $rootLine
 
string null $section
 
string null $additionalQueryParameters
 
string null $backPath
 
bool $moduleLoading = true
 

Detailed Description

Substitution for BackendUtility::getPreviewUrl. Internally BackendUtility::getPreviewUrl is still called due to hooks being invoked there - in the future it basically aims to be a replacement for mentioned function.

Definition at line 31 of file PreviewUriBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Routing\PreviewUriBuilder::__construct ( int  $pageId,
?string  $alternativeUri = null 
)
Parameters
int$pageId‪Page ID to be previewed
string | null$alternativeUri‪Alternative URL to be used instead of /index.php?id=

Definition at line 84 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$alternativeUri, and TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$pageId.

Member Function Documentation

◆ buildAttributes()

◆ buildDispatcherAttributes()

array null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::buildDispatcherAttributes ( ?array  $options = null)

Builds attributes array (e.g. ‘['data-dispatch-action’ => ...]). CAVE: Attributes are NOT XSS-protected and need to be put throughhtmlspecialchars`

Parameters
array | null$options
Returns
‪array|null

Definition at line 195 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\buildAttributes(), TYPO3\CMS\Backend\Routing\PreviewUriBuilder\loadActionDispatcher(), and TYPO3\CMS\Backend\Routing\PreviewUriBuilder\prefixAttributeNames().

Referenced by TYPO3\CMS\Backend\Routing\PreviewUriBuilder\serializeDispatcherAttributes().

◆ buildDispatcherDataAttributes()

array null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::buildDispatcherDataAttributes ( ?array  $options = null)

Builds attributes array (e.g. ‘['dispatch-action’ => ...]). CAVE: Attributes are NOT XSS-protected and need to be put throughhtmlspecialchars`

Parameters
array | null$options
Returns
‪array|null

Definition at line 179 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\buildAttributes(), TYPO3\CMS\Backend\Routing\PreviewUriBuilder\loadActionDispatcher(), and TYPO3\CMS\Backend\Routing\PreviewUriBuilder\prefixAttributeNames().

◆ buildImmediateActionElement()

string null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::buildImmediateActionElement ( ?array  $options = null)

<typo3-immediate-action> does not have a specific meaning and is used to expose data attributes, see custom element in ImmediateActionElement.ts.

Parameters
array | null$options
Returns
‪string|null

Definition at line 225 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\buildAttributes(), and TYPO3\CMS\Backend\Routing\PreviewUriBuilder\loadImmediateActionElement().

◆ buildUri()

Uri null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::buildUri ( ?array  $options = null)

Builds preview URI (still using BackendUtility::getPreviewUrl).

Parameters
array | null$options
Returns
‪Uri|null

Definition at line 152 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\enrichOptions(), and TYPO3\CMS\Backend\Routing\PreviewUriBuilder\OPTION_SWITCH_FOCUS.

Referenced by TYPO3\CMS\Backend\Routing\PreviewUriBuilder\buildAttributes().

◆ create()

static static TYPO3\CMS\Backend\Routing\PreviewUriBuilder::create ( int  $pageId,
?string  $alternativeUri = null 
)
static
Parameters
int$pageId‪Page ID to be previewed
string | null$alternativeUri‪Alternative URL to be used instead of /index.php?id=
Returns
‪static

Definition at line 75 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$alternativeUri, and TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$pageId.

Referenced by TYPO3\CMS\Impexp\ImportExport\addRecord(), TYPO3\CMS\Backend\Tests\Unit\Routing\PreviewUriBuilderTest\attributesContainAlternativeUri(), TYPO3\CMS\Backend\View\PageLayoutView\generateLanguageView(), TYPO3\CMS\Backend\Controller\EditDocumentController\generatePreviewCode(), TYPO3\CMS\Info\Controller\InfoModuleController\getButtons(), TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateModuleController\getButtons(), TYPO3\CMS\Backend\Controller\NewRecordController\getButtons(), TYPO3\CMS\Recordlist\Controller\RecordListController\getDocHeaderButtons(), TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\getPreviewUriBuilder(), TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getPreviewUrlAttributes(), TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController\getRecordActions(), TYPO3\CMS\Backend\Controller\Page\SortSubPagesController\mainAction(), TYPO3\CMS\Backend\Controller\Page\NewMultiplePagesController\mainAction(), TYPO3\CMS\Backend\Controller\PageLayoutController\makeButtons(), TYPO3\CMS\Info\Controller\PageInformationController\pages_drawItem(), TYPO3\CMS\Impexp\Controller\ImportController\registerDocHeaderButtons(), and TYPO3\CMS\Info\Controller\TranslationStatusController\renderL10nTable().

◆ enrichOptions()

array TYPO3\CMS\Backend\Routing\PreviewUriBuilder::enrichOptions ( ?array  $options = null)
protected

Handles options to used for opening preview URI in a new window/tab.

  • switchFocus (bool): whether to focus new window in browser
  • windowName (string): name of window for internal reference
  • windowScope (string): local (current document) global (whole backend)
Parameters
array | null$options
Returns
‪array

Definition at line 273 of file PreviewUriBuilder.php.

Referenced by TYPO3\CMS\Backend\Routing\PreviewUriBuilder\buildAttributes(), and TYPO3\CMS\Backend\Routing\PreviewUriBuilder\buildUri().

◆ loadActionDispatcher()

TYPO3\CMS\Backend\Routing\PreviewUriBuilder::loadActionDispatcher ( )
protected

◆ loadImmediateActionElement()

TYPO3\CMS\Backend\Routing\PreviewUriBuilder::loadImmediateActionElement ( )
protected

◆ prefixAttributeNames()

TYPO3\CMS\Backend\Routing\PreviewUriBuilder::prefixAttributeNames ( string  $prefix,
array  $attributes 
)
protected

◆ serializeDispatcherAttributes()

string null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::serializeDispatcherAttributes ( ?array  $options = null)

Serialized attributes are processed with htmlspecialchars and ready to be used.

Parameters
array | null$options
Returns
‪string|null

Definition at line 210 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\buildDispatcherAttributes().

Referenced by TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\linkWrapItems(), and TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\makeControl().

◆ withAdditionalQueryParameters()

static TYPO3\CMS\Backend\Routing\PreviewUriBuilder::withAdditionalQueryParameters ( string  $additionalQueryParameters)
static
Parameters
string$additionalQueryParameters‪additional URI query parameters
Returns
‪static

Definition at line 136 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$additionalQueryParameters.

◆ withModuleLoading()

static TYPO3\CMS\Backend\Routing\PreviewUriBuilder::withModuleLoading ( bool  $moduleLoading)
static
Parameters
bool$moduleLoading‪whether to enable JavaScript module loading
Returns
‪static

Definition at line 94 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$moduleLoading.

◆ withRootLine()

static TYPO3\CMS\Backend\Routing\PreviewUriBuilder::withRootLine ( array  $rootLine)
static
Parameters
array$rootLine‪(alternative) root-line of pages
Returns
‪static

Definition at line 108 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$rootLine.

◆ withSection()

static TYPO3\CMS\Backend\Routing\PreviewUriBuilder::withSection ( string  $section)
static
Parameters
string$section‪particular section (anchor element)
Returns
‪static

Definition at line 122 of file PreviewUriBuilder.php.

References TYPO3\CMS\Backend\Routing\PreviewUriBuilder\$section.

Member Data Documentation

◆ $additionalQueryParameters

string null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::$additionalQueryParameters
protected

◆ $alternativeUri

string null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::$alternativeUri
protected

◆ $backPath

string null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::$backPath
protected

Not used, kept for potential compatibility issues

Definition at line 64 of file PreviewUriBuilder.php.

◆ $moduleLoading

bool TYPO3\CMS\Backend\Routing\PreviewUriBuilder::$moduleLoading = true
protected

◆ $pageId

int TYPO3\CMS\Backend\Routing\PreviewUriBuilder::$pageId
protected

◆ $rootLine

array null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::$rootLine
protected

◆ $section

string null TYPO3\CMS\Backend\Routing\PreviewUriBuilder::$section
protected

◆ OPTION_SWITCH_FOCUS

◆ OPTION_WINDOW_FEATURES

const TYPO3\CMS\Backend\Routing\PreviewUriBuilder::OPTION_WINDOW_FEATURES = 'windowFeatures'

◆ OPTION_WINDOW_NAME

const TYPO3\CMS\Backend\Routing\PreviewUriBuilder::OPTION_WINDOW_NAME = 'windowName'

Definition at line 34 of file PreviewUriBuilder.php.

◆ OPTION_WINDOW_SCOPE

const TYPO3\CMS\Backend\Routing\PreviewUriBuilder::OPTION_WINDOW_SCOPE = 'windowScope'

◆ OPTION_WINDOW_SCOPE_GLOBAL

const TYPO3\CMS\Backend\Routing\PreviewUriBuilder::OPTION_WINDOW_SCOPE_GLOBAL = 'global'

Definition at line 39 of file PreviewUriBuilder.php.

◆ OPTION_WINDOW_SCOPE_LOCAL

const TYPO3\CMS\Backend\Routing\PreviewUriBuilder::OPTION_WINDOW_SCOPE_LOCAL = 'local'

Definition at line 38 of file PreviewUriBuilder.php.