Skip to content

Commit

Permalink
Update attribute getters
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed Nov 28, 2023
1 parent d5db0ef commit d1671bd
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/wp-includes/class-wp-block-parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,30 @@ public function offsetGet( mixed $offset ): mixed {

return json_decode( substr( $this->post->html, $this->attrs->at, $this->attrs->length ) );

case 'inner_content':
return $this->inner_content;
case 'innerHTML':
$html = '';
foreach ( $this->inner_content as $chunk ) {
if ( $chunk instanceof WP_Span ) {
$html .= substr( $this->post, $chunk->at, $chunk->length );
}
}
return $html;

case 'innerBlocks':

Check failure on line 75 in src/wp-includes/class-wp-block-parser.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

There must be a comment when fall-through is intentional in a non-empty case body
foreach ( $this->inner_content as $chunk ) {
if ( $chunk instanceof WP_Parsed_Block ) {
yield $chunk;
}
}

case 'innerContent':
foreach ( $this->inner_content as $chunk ) {
if ( $chunk instanceof WP_Span ) {
yield substr( $this->post, $chunk->at, $chunk->length );
} else if ( $chunk instanceof WP_Parsed_Block ) {
yield null;
}
}
}
}

Expand Down

0 comments on commit d1671bd

Please sign in to comment.