public function BlockParser::addBlockFromStack in Gutenberg 8.2
Pushes the top block from the parsing stack to the output list.
@since 3.8.0 @internal
Parameters
int|null $end_offset: Byte offset into document for where we should stop sending text output as HTML.
1 call to BlockParser::addBlockFromStack()
- BlockParser::proceed in src/
Parser/ BlockParser.php - Processes the next token from the input document.
File
- src/
Parser/ BlockParser.php, line 408
Class
- BlockParser
- Class BlockParser.
Namespace
Drupal\gutenberg\ParserCode
public function addBlockFromStack($end_offset = NULL) {
$stack_top = array_pop($this->stack);
$prev_offset = $stack_top->prevOffset;
$html = isset($end_offset) ? substr($this->document, $prev_offset, $end_offset - $prev_offset) : substr($this->document, $prev_offset);
if (!empty($html)) {
$stack_top->block->innerHTML .= $html;
$stack_top->block->innerContent[] = $html;
}
if (isset($stack_top->leadingHtmlStart)) {
$this
->addToOutput((array) $this
->freeform(substr($this->document, $stack_top->leadingHtmlStart, $stack_top->tokenStart - $stack_top->leadingHtmlStart)));
}
$this
->addToOutput((array) $stack_top->block);
}