Block Editor: Fix WP_Block_Supports class compatibility with Gutenberg-provided class.

When using WordPress trunk with Gutenberg master, there's an incompatibility causing 
the dynamic block generated classes to be omitted.
This commit refactors the block supports to fix that problem.

Props nosolosw.
Fixes #51606.


git-svn-id: https://develop.svn.wordpress.org/trunk@49310 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella
2020-10-26 08:29:04 +00:00
parent f13776cd8d
commit 7be4701404
4 changed files with 24 additions and 38 deletions

View File

@@ -647,24 +647,11 @@ function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) {
return $output;
}
/**
* Block currently being parsed.
*
* @type array
*/
global $current_parsed_block;
$current_parsed_block = array(
'blockName' => null,
'attributes' => null,
);
/**
* Renders a single block into a HTML string.
*
* @since 5.0.0
*
* @global array $current_parsed_block Block currently being parsed.
* @global WP_Post $post The post to edit.
* @global WP_Query $wp_query WordPress Query object.
* @global WP_Query $wp_query WordPress Query object.
@@ -673,7 +660,7 @@ $current_parsed_block = array(
* @return string String of rendered HTML.
*/
function render_block( $parsed_block ) {
global $post, $wp_query, $current_parsed_block;
global $post, $wp_query;
/**
* Allows render_block() to be short-circuited, by returning a non-null value.
@@ -688,8 +675,6 @@ function render_block( $parsed_block ) {
return $pre_render;
}
$current_parsed_block = $parsed_block;
$source_block = $parsed_block;
/**