WP_Block_Processor::get_span
Returns the span representing the currently-matched delimiter, if matched, otherwise null.
Example:
$processor = new WP_Block_Processor( '<!-- wp:void /-->' ); null === $processor->get_span();
$processor->next_delimiter(); WP_HTML_Span( 0, 17 ) === $processor->get_span();
Method of the class: WP_Block_Processor{}
No Hooks.
Returns
WP_HTML_Span|null. Span of text in source text spanning matched delimiter.
Usage
$WP_Block_Processor = new WP_Block_Processor(); $WP_Block_Processor->get_span(): ?WP_HTML_Span;
Changelog
| Since 6.9.0 | Introduced. |
WP_Block_Processor::get_span() WP Block Processor::get span code WP 7.0
public function get_span(): ?WP_HTML_Span {
switch ( $this->state ) {
case self::HTML_SPAN:
return new WP_HTML_Span( $this->after_previous_delimiter, $this->matched_delimiter_at - $this->after_previous_delimiter );
case self::MATCHED:
return new WP_HTML_Span( $this->matched_delimiter_at, $this->matched_delimiter_length );
default:
return null;
}
}