WP_HTML_Tag_Processor::get_token_type()
Indicates the kind of matched token, if any.
This differs from get_token_name() in that it always returns a static string indicating the type, whereas get_token_name() may return values derived from the token itself, such as a tag name or processing instruction tag.
Possible values:
- #tag when matched on a tag.
- #text when matched on a text node.
- #cdata-section when matched on a CDATA node.
- #comment when matched on a comment.
- #doctype when matched on a DOCTYPE declaration.
- #presumptuous-tag when matched on an empty tag closer.
- #funky-comment when matched on a funky comment.
Method of the class: WP_HTML_Tag_Processor{}
No Hooks.
Return
String|null
. What kind of token is matched, or null.
Usage
$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor(); $WP_HTML_Tag_Processor->get_token_type();
Changelog
Since 6.5.0 | Introduced. |
WP_HTML_Tag_Processor::get_token_type() WP HTML Tag Processor::get token type code WP 6.6.2
public function get_token_type() { switch ( $this->parser_state ) { case self::STATE_MATCHED_TAG: return '#tag'; case self::STATE_DOCTYPE: return '#doctype'; default: return $this->get_token_name(); } }