Skip to content

Commit

Permalink
Remove the experiment flag after reverting pattern block index.php ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
talldan committed Jan 23, 2024
1 parent a783aad commit cd183cc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/block-library/src/block/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,14 @@ function render_block_core_block( $attributes ) {
$content = $wp_embed->run_shortcode( $reusable_block->post_content );
$content = $wp_embed->autoembed( $content );

$gutenberg_experiments = get_option( 'gutenberg-experiments' );
$has_partial_synced_overrides = $gutenberg_experiments
&& array_key_exists( 'gutenberg-pattern-partial-syncing', $gutenberg_experiments )
&& isset( $attributes['overrides'] );
$has_pattern_overrides = isset( $attributes['overrides'] );

/**
* 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 ) {
if ( $has_pattern_overrides ) {
$filter_block_context = static function ( $context ) use ( $attributes ) {
$context['pattern/overrides'] = $attributes['overrides'];
return $context;
Expand All @@ -67,7 +64,7 @@ function render_block_core_block( $attributes ) {
$content = do_blocks( $content );
unset( $seen_refs[ $attributes['ref'] ] );

if ( $has_partial_synced_overrides ) {
if ( $has_pattern_overrides ) {
remove_filter( 'render_block_context', $filter_block_context, 1 );
}

Expand Down

0 comments on commit cd183cc

Please sign in to comment.