Changeset 57760 for trunk/src/wp-includes/blocks/block.php
- Timestamp:
- 03/04/2024 02:06:57 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/block.php
r57578 r57760 47 47 $content = $wp_embed->autoembed( $content ); 48 48 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`. 53 68 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']; 61 70 } 62 $has_pattern_overrides = isset( $attributes['content'] );63 71 64 72 /** … … 67 75 * rendering via do_blocks given it only receives the inner content. 68 76 */ 77 $has_pattern_overrides = isset( $attributes['content'] ); 69 78 if ( $has_pattern_overrides ) { 70 79 $filter_block_context = static function ( $context ) use ( $attributes ) {
Note: See TracChangeset
for help on using the changeset viewer.