diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index 414c1e577b..3b5666b612 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -2234,11 +2234,25 @@ function get_block_categories( $post ) { function get_block_editor_server_block_settings() { $block_registry = WP_Block_Type_Registry::get_instance(); $blocks = array(); - $keys_to_pick = array( 'title', 'description', 'icon', 'category', 'keywords', 'parent', 'supports', 'attributes', 'styles', 'textdomain', 'example' ); + $fields_to_pick = array( + 'title' => 'title', + 'description' => 'description', + 'icon' => 'icon', + 'category' => 'category', + 'keywords' => 'keywords', + 'parent' => 'parent', + 'supports' => 'supports', + 'attributes' => 'attributes', + 'provides_context' => 'providesContext', + 'uses_context' => 'usesContext', + 'styles' => 'styles', + 'textdomain' => 'textdomain', + 'example' => 'example', + ); foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) { - foreach ( $keys_to_pick as $key ) { - if ( ! isset( $block_type->{ $key } ) ) { + foreach ( $fields_to_pick as $field => $key ) { + if ( ! isset( $block_type->{ $field } ) ) { continue; } @@ -2246,7 +2260,7 @@ function get_block_editor_server_block_settings() { $blocks[ $block_name ] = array(); } - $blocks[ $block_name ][ $key ] = $block_type->{ $key }; + $blocks[ $block_name ][ $key ] = $block_type->{ $field }; } } diff --git a/src/wp-includes/class-wp-block-type.php b/src/wp-includes/class-wp-block-type.php index 05d3210cdb..7b5a42bc4e 100644 --- a/src/wp-includes/class-wp-block-type.php +++ b/src/wp-includes/class-wp-block-type.php @@ -74,9 +74,9 @@ class WP_Block_Type { /** * @since 5.5.0 - * @var array + * @var array|null */ - public $supports = array(); + public $supports = null; /** * @since 5.5.0 @@ -100,6 +100,22 @@ class WP_Block_Type { */ public $attributes = null; + /** + * Context values inherited by blocks of this type. + * + * @since 5.5.0 + * @var array + */ + public $uses_context = array(); + + /** + * Context provided by blocks of this type. + * + * @since 5.5.0 + * @var array|null + */ + public $provides_context = null; + /** * Block type editor script handle. * diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php index 020626ccb8..155dd0e326 100644 --- a/tests/phpunit/tests/admin/includesPost.php +++ b/tests/phpunit/tests/admin/includesPost.php @@ -844,7 +844,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase { 'category' => 'common', 'icon' => 'text', 'keywords' => array(), - 'supports' => array(), + 'usesContext' => array(), 'styles' => array(), ), $blocks[ $name ]