PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/block-library/pattern.php +7 -7 23.5.3 → trunk View file →
@@ -32,13 +32,13 @@
32 32 */
33 33 function gutenberg_render_block_core_pattern( $attributes ) {
34 34 static $seen_refs = array();
35 35
36 - if ( empty( $attributes['slug'] ) ) {
36 + $slug = $attributes['slug'] ?? null;
37 + if ( empty( $slug ) || ! is_string( $slug ) ) {
37 38 return '';
38 39 }
39 40
40 - $slug = $attributes['slug'];
41 41 $registry = WP_Block_Patterns_Registry::get_instance();
42 42
43 43 if ( ! $registry->is_registered( $slug ) ) {
44 44 return '';
@@ -43,9 +43,9 @@
43 43 if ( ! $registry->is_registered( $slug ) ) {
44 44 return '';
45 45 }
46 46
47 - if ( isset( $seen_refs[ $attributes['slug'] ] ) ) {
47 + if ( isset( $seen_refs[ $slug ] ) ) {
48 48 // WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
49 49 // is set in `wp_debug_mode()`.
50 50 $is_debug = WP_DEBUG && WP_DEBUG_DISPLAY;
51 51
@@ -57,16 +57,16 @@
57 57
58 58 $pattern = $registry->get_registered( $slug );
59 59 $content = $pattern['content'];
60 60
61 - $seen_refs[ $attributes['slug'] ] = true;
61 + $seen_refs[ $slug ] = true;
62 62
63 - $content = do_blocks( $content );
64 -
65 63 global $wp_embed;
66 64 $content = $wp_embed->autoembed( $content );
67 65
68 - unset( $seen_refs[ $attributes['slug'] ] );
66 + $content = do_blocks( $content );
67 +
68 + unset( $seen_refs[ $slug ] );
69 69 return $content;
70 70 }
71 71
72 72 add_action( 'init', 'gutenberg_register_block_core_pattern', 20 );