Represents an individual tag within an HTML tree.

package XenForo_Html

 Methods

Constructor.

__construct(string $tagName, array $attributes, \XenForo_Html_Tag $parent) 

Parameters

$tagName

string

$attributes

array

Adds a new child tag.

addChildTag(string $tagName, array $attributes) : \XenForo_Html_Tag

Parameters

$tagName

string

$attributes

array

Returns

\XenForo_Html_TagNew child tag

Appends text to the tag.

appendText(string $text) 

If the last child is text, it will be added to that child; otherwise, a new child will be created.

Parameters

$text

string

Gets the named attribute.

attribute(string $attribute) : mixed | false

Parameters

$attribute

string

Returns

mixedfalse

Gets the attributes.

attributes() : array

Returns

array

Gets the child tags and text.

children() : array

Returns

array

Closes the given tag.

closeTag(string $tagName) : \XenForo_Html_Tag

This generally does not require modifying the tag tree, unless invalid nesting occurred.

Parameters

$tagName

string

Returns

\XenForo_Html_TagThe new "parent" tag that should be used by the parser

Copies this tag.

copy() : \XenForo_HTml_Tag

Does not copy any children tags or this tag's parent. The parent will need to be set manually later.

Returns

\XenForo_HTml_Tag

Determines if this tag is a block-level tag.

isBlock() : boolean

Returns

boolean

Determines if the tag has renderable content within.

isEmpty() : boolean

Returns

boolean

Determines if this tag is a void tag.

isVoid() : boolean

Void tags can't have children.

Returns

boolean

Gets the parent tag.

parent() : \XenForo_Html_Tag | null

Returns

Sets the parent tag.

setParent(\XenForo_Html_Tag $parent) 

This does not check for circular references!

Parameters

Gets the tag name.

tagName() : string

Returns

string

 Properties

 

Key-value pairs of attributes for the tag

$_attributes : array

 

List of tags that are considered to be block tags.

$_blockTags : array

 

List of child tags and text.

$_children : array

 

Parent tag object.

$_parent : \XenForo_Html_Tag | null

 

Name of the tag (lower case).

$_tagName : string

 

$_voidTags

$_voidTags