Skip to content

Commit

Permalink
Fix the interface to provide what Core already needs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed Dec 7, 2023
1 parent f52c7bc commit 13c1fb1
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 399 deletions.
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 @@ -484,7 +484,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 @@ -813,7 +813,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

0 comments on commit 13c1fb1

Please sign in to comment.