WP_Block_Parser::add_inner_block()
Given a block structure from memory pushes a new block to the output list.
Метод класса: WP_Block_Parser{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WP_Block_Parser = new WP_Block_Parser(); $WP_Block_Parser->add_inner_block( $block, $token_start, $token_length, $last_offset );
- $block(WP_Block_Parser_Block) (обязательный)
- The block to add to the output.
- $token_start(int) (обязательный)
- Byte offset into the document where the first token for the block starts.
- $token_length(int) (обязательный)
- Byte length of entire block from start of opening token to end of closing token.
- $last_offset(int|null)
- Last byte offset into document if continuing form earlier output.
По умолчанию: null
Список изменений
С версии 5.0.0 | Введена. |
Код WP_Block_Parser::add_inner_block() WP Block Parser::add inner block WP 6.7.2
public function add_inner_block( WP_Block_Parser_Block $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->prev_offset, $token_start - $parent->prev_offset ); if ( ! empty( $html ) ) { $parent->block->innerHTML .= $html; $parent->block->innerContent[] = $html; } $parent->block->innerContent[] = null; $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length; }