public function BlockParser::addInnerBlock in Gutenberg 8.2
Given a block structure from memory pushes a new block to the output list.
@internal @since 3.8.0
Parameters
BlockParserBlock $block: The block to add to the output.
int $token_start: Byte offset into the document where the first token for the block starts.
int $token_length: Byte length of entire block from start of opening token to end of closing token.
int|null $last_offset: Last byte offset into document if continuing form earlier output.
1 call to BlockParser::addInnerBlock()
- BlockParser::proceed in src/
Parser/ BlockParser.php - Processes the next token from the input document.
File
- src/
Parser/ BlockParser.php, line 384
Class
- BlockParser
- Class BlockParser.
Namespace
Drupal\gutenberg\ParserCode
public function addInnerBlock(BlockParserBlock $block, $token_start, $token_length, $last_offset = NULL) {
$parent = $this->stack[count($this->stack) - 1];
$parent->block->innerBlocks[] = (array) $block;
$html = substr($this->document, $parent->prevOffset, $token_start - $parent->prevOffset);
if (!empty($html)) {
$parent->block->innerHTML .= $html;
$parent->block->innerContent[] = $html;
}
$parent->block->innerContent[] = NULL;
$parent->prevOffset = $last_offset ? $last_offset : $token_start + $token_length;
}