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
@@ -96,11 +96,13 @@ class Block_Supported_Styles_Test extends WP_UnitTestCase {
* Returns the rendered output for the current block.
*
* @param array $block Block to render.
*
* @return string Rendered output for the current block.
*/
private function render_example_block( $block ) {
global $current_parsed_block;
$current_parsed_block = $block;
$wrapper_attributes = get_block_wrapper_attributes(
WP_Block_Supports::init();
WP_Block_Supports::$block_to_render = $block;
$wrapper_attributes = get_block_wrapper_attributes(
array(
'class' => 'foo-bar-class',
'style' => 'test: style;',