Make WordPress Core


Ignore:
Timestamp:
03/04/2024 02:06:57 PM (3 years ago)
Author:
youknowriad
Message:

Editor: Update Packages with the latest bug fixes for 6.5 RC 1

It includes all the backports from this Gutenberg PR ​https://github.com/WordPress/gutenberg/pull/59541/

Props get_dave, youknowriad, talldanwp.
See #60315.
Fixes #60665.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/block.php

    r57578 r57760  
    4747        $content = $wp_embed->autoembed( $content );
    4848
    49         // Back compat, the content attribute was previously named overrides and
    50         // had a slightly different format. For blocks that have not been migrated,
    51         // also convert the format here so that the provided `pattern/overrides`
    52         // context is correct.
     49        // Back compat.
     50        // For blocks that have not been migrated in the editor, add some back compat
     51        // so that front-end rendering continues to work.
     52
     53        // This matches the `v2` deprecation. Removes the inner `values` property
     54        // from every item.
     55        if ( isset( $attributes['content'] ) ) {
     56                foreach ( $attributes['content'] as &$content_data ) {
     57                        if ( isset( $content_data['values'] ) ) {
     58                                $is_assoc_array = is_array( $content_data['values'] ) && ! wp_is_numeric_array( $content_data['values'] );
     59
     60                                if ( $is_assoc_array ) {
     61                                        $content_data = $content_data['values'];
     62                                }
     63                        }
     64                }
     65        }
     66
     67        // This matches the `v1` deprecation. Rename `overrides` to `content`.
    5368        if ( isset( $attributes['overrides'] ) && ! isset( $attributes['content'] ) ) {
    54                 $migrated_content = array();
    55                 foreach ( $attributes['overrides'] as $id => $values ) {
    56                         $migrated_content[ $id ] = array(
    57                                 'values' => $values,
    58                         );
    59                 }
    60                 $attributes['content'] = $migrated_content;
     69                $attributes['content'] = $attributes['overrides'];
    6170        }
    62         $has_pattern_overrides = isset( $attributes['content'] );
    6371
    6472        /**
    … …  
    6775         * rendering via do_blocks given it only receives the inner content.
    6876         */
     77        $has_pattern_overrides = isset( $attributes['content'] );
    6978        if ( $has_pattern_overrides ) {
    7079                $filter_block_context = static function ( $context ) use ( $attributes ) {
Note: See TracChangeset for help on using the changeset viewer.