mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Add fields to WP_Block_Type
As part of #47620 and the RFC for block registeration. Server registered blocks are missing some fields. These changeset includes them. Props spacedmonkey, aduth. Fixes #48529. Built from https://develop.svn.wordpress.org/trunk@47875 git-svn-id: http://core.svn.wordpress.org/trunk@47649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1c176ffb1e
commit
c704057e0d
@ -2234,7 +2234,7 @@ 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' );
|
||||
$keys_to_pick = array( 'title', 'description', 'icon', 'category', 'keywords', 'parent', 'supports', 'attributes', 'styles', 'textdomain', 'example' );
|
||||
|
||||
foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {
|
||||
foreach ( $keys_to_pick as $key ) {
|
||||
|
@ -15,6 +15,7 @@
|
||||
* @see register_block_type()
|
||||
*/
|
||||
class WP_Block_Type {
|
||||
|
||||
/**
|
||||
* Block type key.
|
||||
*
|
||||
@ -23,21 +24,81 @@ class WP_Block_Type {
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var string
|
||||
*/
|
||||
public $title = '';
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var string
|
||||
*/
|
||||
public $category = '';
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var array|null
|
||||
*/
|
||||
public $parent = null;
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var string
|
||||
*/
|
||||
public $icon = '';
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var string
|
||||
*/
|
||||
public $description = '';
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var array
|
||||
*/
|
||||
public $keywords = array();
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var string|null
|
||||
*/
|
||||
public $textdomain = null;
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var array
|
||||
*/
|
||||
public $styles = array();
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var array
|
||||
*/
|
||||
public $supports = array();
|
||||
|
||||
/**
|
||||
* @since 5.5.0
|
||||
* @var array|null
|
||||
*/
|
||||
public $example = null;
|
||||
|
||||
/**
|
||||
* Block type render callback.
|
||||
*
|
||||
* @since 5.0.0
|
||||
* @var callable
|
||||
*/
|
||||
public $render_callback;
|
||||
public $render_callback = null;
|
||||
|
||||
/**
|
||||
* Block type attributes property schemas.
|
||||
*
|
||||
* @since 5.0.0
|
||||
* @var array
|
||||
* @var array|null
|
||||
*/
|
||||
public $attributes;
|
||||
public $attributes = null;
|
||||
|
||||
/**
|
||||
* Block type editor script handle.
|
||||
@ -45,7 +106,7 @@ class WP_Block_Type {
|
||||
* @since 5.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $editor_script;
|
||||
public $editor_script = '';
|
||||
|
||||
/**
|
||||
* Block type front end script handle.
|
||||
@ -53,7 +114,7 @@ class WP_Block_Type {
|
||||
* @since 5.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $script;
|
||||
public $script = '';
|
||||
|
||||
/**
|
||||
* Block type editor style handle.
|
||||
@ -61,7 +122,7 @@ class WP_Block_Type {
|
||||
* @since 5.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $editor_style;
|
||||
public $editor_style = '';
|
||||
|
||||
/**
|
||||
* Block type front end style handle.
|
||||
@ -69,20 +130,21 @@ class WP_Block_Type {
|
||||
* @since 5.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $style;
|
||||
public $style = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Will populate object properties from the provided arguments.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @see register_block_type()
|
||||
*
|
||||
* @param string $block_type Block type name including namespace.
|
||||
* @param array|string $args Optional. Array or string of arguments for registering a block type.
|
||||
* Default empty array.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @see register_block_type()
|
||||
*
|
||||
*/
|
||||
public function __construct( $block_type, $args = array() ) {
|
||||
$this->name = $block_type;
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-47874';
|
||||
$wp_version = '5.5-alpha-47875';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user