Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tokenizer.php

function Tokenizer::setTextMode

Set the text mode for the character data reader.

HTML5 defines three different modes for reading text:

  • Normal: Read until a tag is encountered.
  • RCDATA: Read until a tag is encountered, but skip a few otherwise-

special characters.

  • Raw: Read until a special closing tag is encountered (viz. pre, script)

This allows those modes to be set.

Normally, setting is done by the event handler via a special return code on startTag(), but it can also be set manually using this function.

Parameters

int $textmode One of Elements::TEXT_*.:

string $untilTag The tag that should stop RAW or RCDATA mode. Normal mode does not: use this indicator.

3 calls to Tokenizer::setTextMode()
Tokenizer::rawText in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Read text in RAW mode.
Tokenizer::rcdata in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Read text in RCDATA mode.
Tokenizer::tagName in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Consume a tag name and body. See section 8.2.4.10.

File

vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php, line 105

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

public function setTextMode($textmode, $untilTag = null) {
    $this->textMode = $textmode & (Elements::TEXT_RAW | Elements::TEXT_RCDATA);
    $this->untilTag = $untilTag;
}
RSS feed
Powered by Drupal