mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-20 15:21:28 +01:00
Editor: Make block type aware of the ancestor
field
The `ancestor` field was recently added to the `block.json` schema in Gutenberg. See: https://github.com/WordPress/gutenberg/pull/39894. Props darerodz. Fixes #55531. Built from https://develop.svn.wordpress.org/trunk@53084 git-svn-id: http://core.svn.wordpress.org/trunk@52673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7d9102b06
commit
a9008e6cc5
@ -2232,6 +2232,7 @@ function get_block_editor_server_block_settings() {
|
|||||||
'styles' => 'styles',
|
'styles' => 'styles',
|
||||||
'textdomain' => 'textdomain',
|
'textdomain' => 'textdomain',
|
||||||
'parent' => 'parent',
|
'parent' => 'parent',
|
||||||
|
'ancestor' => 'ancestor',
|
||||||
'keywords' => 'keywords',
|
'keywords' => 'keywords',
|
||||||
'example' => 'example',
|
'example' => 'example',
|
||||||
'variations' => 'variations',
|
'variations' => 'variations',
|
||||||
|
@ -58,6 +58,15 @@ class WP_Block_Type {
|
|||||||
*/
|
*/
|
||||||
public $parent = null;
|
public $parent = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setting ancestor makes a block available only inside the specified
|
||||||
|
* block types at any position of the ancestor's block subtree.
|
||||||
|
*
|
||||||
|
* @since 6.0.0
|
||||||
|
* @var array|null
|
||||||
|
*/
|
||||||
|
public $ancestor = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block type icon.
|
* Block type icon.
|
||||||
*
|
*
|
||||||
@ -207,6 +216,7 @@ class WP_Block_Type {
|
|||||||
* @since 5.6.0 Added the `api_version` property.
|
* @since 5.6.0 Added the `api_version` property.
|
||||||
* @since 5.8.0 Added the `variations` property.
|
* @since 5.8.0 Added the `variations` property.
|
||||||
* @since 5.9.0 Added the `view_script` property.
|
* @since 5.9.0 Added the `view_script` property.
|
||||||
|
* @since 6.0.0 Added the `ancestor` property.
|
||||||
*
|
*
|
||||||
* @see register_block_type()
|
* @see register_block_type()
|
||||||
*
|
*
|
||||||
@ -221,6 +231,8 @@ class WP_Block_Type {
|
|||||||
* search interfaces to arrange block types by category.
|
* search interfaces to arrange block types by category.
|
||||||
* @type array|null $parent Setting parent lets a block require that it is only
|
* @type array|null $parent Setting parent lets a block require that it is only
|
||||||
* available when nested within the specified blocks.
|
* available when nested within the specified blocks.
|
||||||
|
* @type array|null $ancestor Setting ancestor makes a block available only inside the specified
|
||||||
|
* block types at any position of the ancestor's block subtree.
|
||||||
* @type string|null $icon Block type icon.
|
* @type string|null $icon Block type icon.
|
||||||
* @type string $description A detailed block type description.
|
* @type string $description A detailed block type description.
|
||||||
* @type string[] $keywords Additional keywords to produce block type as
|
* @type string[] $keywords Additional keywords to produce block type as
|
||||||
|
@ -266,6 +266,7 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
|
|||||||
'category',
|
'category',
|
||||||
'keywords',
|
'keywords',
|
||||||
'parent',
|
'parent',
|
||||||
|
'ancestor',
|
||||||
'provides_context',
|
'provides_context',
|
||||||
'uses_context',
|
'uses_context',
|
||||||
'supports',
|
'supports',
|
||||||
@ -645,6 +646,16 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
|
|||||||
'context' => array( 'embed', 'view', 'edit' ),
|
'context' => array( 'embed', 'view', 'edit' ),
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
),
|
),
|
||||||
|
'ancestor' => array(
|
||||||
|
'description' => __( 'Ancestor blocks.' ),
|
||||||
|
'type' => array( 'array', 'null' ),
|
||||||
|
'items' => array(
|
||||||
|
'type' => 'string',
|
||||||
|
),
|
||||||
|
'default' => null,
|
||||||
|
'context' => array( 'embed', 'view', 'edit' ),
|
||||||
|
'readonly' => true,
|
||||||
|
),
|
||||||
'keywords' => $keywords_definition,
|
'keywords' => $keywords_definition,
|
||||||
'example' => $example_definition,
|
'example' => $example_definition,
|
||||||
),
|
),
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-53083';
|
$wp_version = '6.0-alpha-53084';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user