Documentation

TwigTokenParserScript extends AbstractTokenParser
in package

Adds a script to head/bottom/custom group location in the document.

{% script 'theme://js/something.js' at 'bottom' priority: 20 with { position: 'pipeline', loading: 'async defer' } %} {% script module 'theme://js/module.mjs' at 'head' %}

{% script 'theme://js/something.js' at 'bottom' priority: 20 with { loading: 'inline' } %} {% script at 'bottom' priority: 20 %} alert('Warning!'); {% endscript %}

{% script module 'theme://js/module.mjs' at 'bottom' with { loading: 'inline' } %} {% script module at 'bottom' %} ... {% endscript %}

Table of Contents

Methods

decideBlockEnd()  : bool
getTag()  : string
Gets the tag name associated with this token parser.
parse()  : TwigNodeScript
Parses a token and returns a node.
parseArguments()  : array<string|int, mixed>

Methods

decideBlockEnd()

public decideBlockEnd(Token $token) : bool
Parameters
$token : Token
Return values
bool

getTag()

Gets the tag name associated with this token parser.

public getTag() : string
Return values
string

The tag name

parseArguments()

protected parseArguments(Token $token) : array<string|int, mixed>
Parameters
$token : Token
Return values
array<string|int, mixed>

        
On this page

Search results