Skip to content

Commit

Permalink
Rename to pattern/overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Nov 30, 2023
1 parent a1ecae4 commit 728f592
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/block-supports/pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function gutenberg_register_pattern_support( $block_type ) {
$block_type->uses_context = array();
}

if ( ! in_array( 'overrides', $block_type->uses_context, true ) ) {
$block_type->uses_context[] = 'overrides';
if ( ! in_array( 'pattern/overrides', $block_type->uses_context, true ) ) {
$block_type->uses_context[] = 'pattern/overrides';
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/experimental/connection-sources/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
},
'pattern_attributes' => function ( $block_instance ) {
$block_id = $block_instance->attributes['metadata']['id'];
return _wp_array_get( $block_instance->context, array( 'overrides', $block_id ), false );
return _wp_array_get( $block_instance->context, array( 'pattern/overrides', $block_id ), false );
},
);
4 changes: 2 additions & 2 deletions packages/block-library/src/block/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ function render_block_core_block( $attributes ) {
&& isset( $attributes['overrides'] );

/**
* We set the `overrides` context through the `render_block_context`
* We set the `pattern/overrides` context through the `render_block_context`
* filter so that it is available when a pattern's inner blocks are
* rendering via do_blocks given it only receives the inner content.
*/
if ( $has_partial_synced_overrides ) {
$filter_block_context = static function ( $context ) use ( $attributes ) {
$context['overrides'] = $attributes['overrides'];
$context['pattern/overrides'] = $attributes['overrides'];
return $context;
};
add_filter( 'render_block_context', $filter_block_context, 1 );
Expand Down

0 comments on commit 728f592

Please sign in to comment.