PreviewUriBuilder

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.

Table of Contents

Constants

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

Properties

$additionalQueryParameters  : string|null
$alternativeUri  : string|null
$backPath  : string|null
$moduleLoading  : bool
$pageId  : int
$rootLine  : array<string|int, mixed>|null
$section  : string|null

Methods

__construct()  : mixed
buildDispatcherAttributes()  : array<string|int, mixed>|null
Builds attributes array (e.g. `['data-dispatch-action' => ...]`).
buildDispatcherDataAttributes()  : array<string|int, mixed>|null
Builds attributes array (e.g. `['dispatch-action' => ...]`).
buildImmediateActionElement()  : string|null
`<typo3-immediate-action>` does not have a specific meaning and is used to expose `data` attributes, see custom element in `ImmediateActionElement.ts`.
buildUri()  : Uri|null
Builds preview URI (still using `BackendUtility::getPreviewUrl`).
create()  : static
serializeDispatcherAttributes()  : string|null
Serialized attributes are processed with `htmlspecialchars` and ready to be used.
withAdditionalQueryParameters()  : static
withModuleLoading()  : static
withRootLine()  : static
withSection()  : static
buildAttributes()  : array<string|int, mixed>|null
enrichOptions()  : array<string|int, mixed>
Handles options to used for opening preview URI in a new window/tab.
loadActionDispatcher()  : void
loadImmediateActionElement()  : void
prefixAttributeNames()  : array<string|int, mixed>

Constants

OPTION_SWITCH_FOCUS

public mixed OPTION_SWITCH_FOCUS = 'switchFocus'

OPTION_WINDOW_FEATURES

public mixed OPTION_WINDOW_FEATURES = 'windowFeatures'

OPTION_WINDOW_NAME

public mixed OPTION_WINDOW_NAME = 'windowName'

OPTION_WINDOW_SCOPE

public mixed OPTION_WINDOW_SCOPE = 'windowScope'

OPTION_WINDOW_SCOPE_GLOBAL

public mixed OPTION_WINDOW_SCOPE_GLOBAL = 'global'

OPTION_WINDOW_SCOPE_LOCAL

public mixed OPTION_WINDOW_SCOPE_LOCAL = 'local'

Properties

$additionalQueryParameters

protected string|null $additionalQueryParameters

$alternativeUri

protected string|null $alternativeUri

$backPath

protected string|null $backPath
Internal

Not used, kept for potential compatibility issues

$moduleLoading

protected bool $moduleLoading = true

$rootLine

protected array<string|int, mixed>|null $rootLine

Methods

__construct()

public __construct(int $pageId[, string|null $alternativeUri = null ]) : mixed
Parameters
$pageId : int

Page ID to be previewed

$alternativeUri : string|null = null

Alternative URL to be used instead of /index.php?id=

buildDispatcherAttributes()

Builds attributes array (e.g. `['data-dispatch-action' => ...]`).

public buildDispatcherAttributes([array<string|int, mixed>|null $options = null ]) : array<string|int, mixed>|null

CAVE: Attributes are NOT XSS-protected and need to be put through htmlspecialchars

Parameters
$options : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>|null

buildDispatcherDataAttributes()

Builds attributes array (e.g. `['dispatch-action' => ...]`).

public buildDispatcherDataAttributes([array<string|int, mixed>|null $options = null ]) : array<string|int, mixed>|null

CAVE: Attributes are NOT XSS-protected and need to be put through htmlspecialchars

Parameters
$options : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>|null

buildImmediateActionElement()

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

public buildImmediateActionElement([array<string|int, mixed>|null $options = null ]) : string|null
Parameters
$options : array<string|int, mixed>|null = null
Return values
string|null

buildUri()

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

public buildUri([array<string|int, mixed>|null $options = null ]) : Uri|null
Parameters
$options : array<string|int, mixed>|null = null
Return values
Uri|null

create()

public static create(int $pageId[, string|null $alternativeUri = null ]) : static
Parameters
$pageId : int

Page ID to be previewed

$alternativeUri : string|null = null

Alternative URL to be used instead of /index.php?id=

Return values
static

serializeDispatcherAttributes()

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

public serializeDispatcherAttributes([array<string|int, mixed>|null $options = null ]) : string|null
Parameters
$options : array<string|int, mixed>|null = null
Return values
string|null

withAdditionalQueryParameters()

public withAdditionalQueryParameters(string $additionalQueryParameters) : static
Parameters
$additionalQueryParameters : string

additional URI query parameters

Return values
static

withModuleLoading()

public withModuleLoading(bool $moduleLoading) : static
Parameters
$moduleLoading : bool

whether to enable JavaScript module loading

Return values
static

withRootLine()

public withRootLine(array<string|int, mixed> $rootLine) : static
Parameters
$rootLine : array<string|int, mixed>

(alternative) root-line of pages

Return values
static

withSection()

public withSection(string $section) : static
Parameters
$section : string

particular section (anchor element)

Return values
static

buildAttributes()

protected buildAttributes([array<string|int, mixed>|null $options = null ]) : array<string|int, mixed>|null
Parameters
$options : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>|null

enrichOptions()

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

protected enrichOptions([array<string|int, mixed>|null $options = null ]) : array<string|int, mixed>
  • 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
$options : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>

loadActionDispatcher()

protected loadActionDispatcher() : void

loadImmediateActionElement()

protected loadImmediateActionElement() : void

prefixAttributeNames()

protected prefixAttributeNames(string $prefix, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$prefix : string
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results