final class Tag

Represents a Latte tag or n:attribute during parsing.

Constants

PrefixInner

PrefixTag

PrefixNone

OutputNone

OutputKeepIndentation

OutputRemoveIndentation

Properties

$parser
$outputMode

Methods

__construct(string $name, array $tokens, Range $position, bool $void = false, bool $closing = false, bool $inHead = false, bool $inTag = false, ElementNode|null $htmlElement = null, Tag|null $parent = null, string|null $prefix = null, AreaNode|null $node = null, AreaNode|null $nAttribute = null)

No description

bool
isInHead()

No description

bool
isInText()

No description

bool
isNAttribute()

No description

string
getNotation(bool $withArgs = false)

Returns the tag notation, e.g. {tagName} or n:tagName="...".

Tag|null
closestTag(array $classes, callable|null $condition = null)

Finds the nearest ancestor tag whose node is an instance of one of the given classes, optionally filtered by a condition. Returns null if none is found.

void
expectArguments(string $what = 'arguments')

Throws a CompileException if the tag has no arguments.

void
replaceNAttribute(AreaNode $node)

Replaces the current n:attribute node in the parent HTML element with the given node.

Details

at line 36
__construct(string $name, array $tokens, Range $position, bool $void = false, bool $closing = false, bool $inHead = false, bool $inTag = false, ElementNode|null $htmlElement = null, Tag|null $parent = null, string|null $prefix = null, AreaNode|null $node = null, AreaNode|null $nAttribute = null)

No description

Parameters

string $name
array $tokens
Range $position
bool $void
bool $closing
bool $inHead
bool $inTag
ElementNode|null $htmlElement
Tag|null $parent
string|null $prefix
AreaNode|null $node
AreaNode|null $nAttribute

at line 54
bool isInHead()

No description

Return Value

bool

at line 60
bool isInText()

No description

Return Value

bool

at line 66
bool isNAttribute()

No description

Return Value

bool

at line 75
string getNotation(bool $withArgs = false)

Returns the tag notation, e.g. {tagName} or n:tagName="...".

Parameters

bool $withArgs

Return Value

string

at line 94
Tag|null closestTag(array $classes, callable|null $condition = null)

Finds the nearest ancestor tag whose node is an instance of one of the given classes, optionally filtered by a condition. Returns null if none is found.

Parameters

array $classes
callable|null $condition

Return Value

Tag|null

at line 111
void expectArguments(string $what = 'arguments')

Throws a CompileException if the tag has no arguments.

Parameters

string $what

Return Value

void

at line 122
void replaceNAttribute(AreaNode $node)

Replaces the current n:attribute node in the parent HTML element with the given node.

Parameters

AreaNode $node

Return Value

void