JavaScriptRenderer

class \TYPO3\CMS\Core\Page\JavaScriptRenderer

Table of Contents

Properties

$handlerResource  : string
$importMap  : ImportMap
$instructionsWithItems  : int
$items  : JavaScriptItems
$javaScriptModuleInstructionFlags  : int

Methods

__construct()  : mixed
addGlobalAssignment()  : void
addJavaScriptModuleInstruction()  : void
create()  : self
getState()  : array
hasImportMap()  : bool
includeAllImports()  : void
HEADS UP: Do only use in authenticated mode as this discloses as installed extensions
includeTaggedImports()  : void
render()  : string
renderImportMap()  : string
toArray()  : array<int, array{type: string, payload: mixed}>
updateState()  : void
createItemHandlerElement()  : string
createScriptElement()  : string
isEmpty()  : bool
jsonEncode()  : string
mergeGlobalAssignments()  : array

Properties

$handlerResource

protected string $handlerResource

$instructionsWithItems

protected int $instructionsWithItems = 0

$javaScriptModuleInstructionFlags

protected int $javaScriptModuleInstructionFlags = 0

Methods

__construct()

public __construct(string $handlerResource) : mixed

Parameters

$handlerResource : string

addGlobalAssignment()

public addGlobalAssignment(array $payload) : void

Parameters

$payload : array

create()

public static create([string|null $resourceIdentifier = null ]) : self

Parameters

$resourceIdentifier : string|null = null

Return values

self

getState()

public getState() : array

Return values

array

hasImportMap()

public hasImportMap() : bool

Return values

bool

includeAllImports()

HEADS UP: Do only use in authenticated mode as this discloses as installed extensions

public includeAllImports() : void

includeTaggedImports()

public includeTaggedImports(string $tag) : void

Parameters

$tag : string

render()

public render(string|ConsumableNonce|null $nonce, string $uriPrefix) : string

Parameters

$nonce : string|ConsumableNonce|null
$uriPrefix : string

Tags

throws
InvalidArgumentException

when a JavaScript module could not be resolved (no src URL in import map)

Return values

string

renderImportMap()

public renderImportMap(string $uriPrefix[, string|ConsumableNonce|null $nonce = null ]) : string

Parameters

$uriPrefix : string
$nonce : string|ConsumableNonce|null = null

Return values

string

toArray()

public toArray() : array<int, array{type: string, payload: mixed}>

Return values

array<int, array{type: string, payload: mixed}>

updateState()

public updateState(array $state) : void

Parameters

$state : array

createItemHandlerElement()

protected createItemHandlerElement(array $payload, bool $async, string|ConsumableNonce|null $nonce, string $uriPrefix) : string

Parameters

$payload : array
$async : bool
$nonce : string|ConsumableNonce|null
$uriPrefix : string

Return values

string

createScriptElement()

protected createScriptElement(array $attributes[, string $textContent = '' ]) : string

Parameters

$attributes : array
$textContent : string = ''

Return values

string

isEmpty()

protected isEmpty() : bool

Return values

bool

jsonEncode()

protected jsonEncode(mixed $value) : string

Parameters

$value : mixed

Return values

string

mergeGlobalAssignments()

protected mergeGlobalAssignments(array $assignments) : array

Parameters

$assignments : array

Return values

array
On this page