| @@ -1,5 +1,5 @@ | ||
| 1 | -<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName // Needed for WP_Block_Cloner helper class. | |
| 1 | +<?php | |
| 2 | 2 | /** |
| 3 | 3 | * Server-side rendering of the `core/block` block. |
| 4 | 4 | * |
| 5 | 5 | * @package WordPress |
| @@ -82,33 +82,9 @@ | ||
| 82 | 82 | * those blocks. |
| 83 | 83 | */ |
| 84 | 84 | $block_instance->parsed_block['innerBlocks'] = parse_blocks( $content ); |
| 85 | 85 | $block_instance->parsed_block['innerContent'] = array_fill( 0, count( $block_instance->parsed_block['innerBlocks'] ), null ); |
| 86 | - if ( method_exists( $block_instance, 'refresh_context_dependents' ) ) { | |
| 87 | - // WP_Block::refresh_context_dependents() was introduced in WordPress 6.8. | |
| 88 | - $block_instance->refresh_context_dependents(); | |
| 89 | - } else { | |
| 90 | - // This branch can be removed once Gutenberg requires WordPress 6.8 or later. | |
| 91 | - if ( ! class_exists( 'WP_Block_Cloner' ) ) { | |
| 92 | - // phpcs:ignore Gutenberg.Commenting.SinceTag.MissingClassSinceTag | |
| 93 | - class WP_Block_Cloner extends WP_Block { | |
| 94 | - /** | |
| 95 | - * Static methods of subclasses have access to protected properties | |
| 96 | - * of instances of the parent class. | |
| 97 | - * In this case, this gives us access to `available_context` and `registry`. | |
| 98 | - */ | |
| 99 | - // phpcs:ignore Gutenberg.Commenting.SinceTag.MissingMethodSinceTag | |
| 100 | - public static function clone_instance( $instance ) { | |
| 101 | - return new WP_Block( | |
| 102 | - $instance->parsed_block, | |
| 103 | - $instance->available_context, | |
| 104 | - $instance->registry | |
| 105 | - ); | |
| 106 | - } | |
| 107 | - } | |
| 108 | - } | |
| 109 | - $block_instance = WP_Block_Cloner::clone_instance( $block_instance ); | |
| 110 | - } | |
| 86 | + $block_instance->refresh_context_dependents(); | |
| 111 | 87 | |
| 112 | 88 | $content = $block_instance->render( array( 'dynamic' => false ) ); |
| 113 | 89 | unset( $seen_refs[ $attributes['ref'] ] ); |
| 114 | 90 | |