Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Parser: Explore a streaming lazy interface #5705

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/wp-includes/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ function _inject_theme_attribute_in_template_part_block( &$block ) {
'core/template-part' === $block['blockName'] &&
! isset( $block['attrs']['theme'] )
) {
$block['attrs']['theme'] = get_stylesheet();
$attrs = $block['attrs'];
$attrs['theme'] = get_stylesheet();
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,8 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl
foreach ( $attribute_to_prefix_map as $style_attribute => $prefix ) {
if ( ! empty( $parsed_block['attrs']['style']['typography'][ $style_attribute ] ) ) {
$prefix_len = strlen( $prefix );
$attribute_value = &$parsed_block['attrs']['style']['typography'][ $style_attribute ];
$attrs = $parsed_block['attrs'];
$attribute_value = &$attrs['style']['typography'][ $style_attribute ];
if ( 0 === strncmp( $attribute_value, $prefix, $prefix_len ) ) {
$attribute_value = substr( $attribute_value, $prefix_len );
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-block-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function offsetExists( $offset ) {
public function offsetGet( $offset ) {
$block = $this->blocks[ $offset ];

if ( isset( $block ) && is_array( $block ) ) {
if ( isset( $block ) && ( is_array( $block ) || $block instanceof WP_Parsed_Block ) ) {
$block = new WP_Block( $block, $this->available_context, $this->registry );

$this->blocks[ $offset ] = $block;
Expand Down
Loading
Loading