From db229c96ef0623fb6bbd27b05d28aef568d041fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Wed, 14 Dec 2022 14:16:54 +0100 Subject: [PATCH] compat/6.1: get_style_nodes & get_block_nodes add missing backport https://github.com/WordPress/gutenberg/pull/41217 --- lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php b/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php index 272c2fe8b76fba..fcb7037e854cbe 100644 --- a/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php +++ b/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php @@ -1935,7 +1935,7 @@ protected static function get_style_nodes( $theme_json, $selectors = array() ) { return $nodes; } - $block_nodes = static::get_block_nodes( $theme_json ); + $block_nodes = static::get_block_nodes( $theme_json, $selectors ); foreach ( $block_nodes as $block_node ) { $nodes[] = $block_node; } @@ -2007,10 +2007,11 @@ private static function update_separator_declarations( $declarations ) { * @since 6.1.0 * * @param array $theme_json The theme.json converted to an array. + * @param array $selectors Optional list of selectors per block. * @return array The block nodes in theme.json. */ - private static function get_block_nodes( $theme_json ) { - $selectors = static::get_blocks_metadata(); + private static function get_block_nodes( $theme_json, $selectors = array() ) { + $selectors = empty( $selectors ) ? static::get_blocks_metadata() : $selectors; $nodes = array(); if ( ! isset( $theme_json['styles'] ) ) { return $nodes;