Editor: Register 'lock' attribute for every block on the server
Backports changes from https://github.com/WordPress/gutenberg/pull/40468. The lock attribute needs to be supported by every block, but currently, it is only done on the client site. As a result, it was causing block rendered API requests to fail when blocks are locked. Props mamaduka, peterwilsoncc. See #55567. Built from https://develop.svn.wordpress.org/trunk@53268 git-svn-id: http://core.svn.wordpress.org/trunk@52857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
22de3f7711
commit
1dabd8df68
|
@ -204,6 +204,16 @@ class WP_Block_Type {
|
|||
*/
|
||||
public $style = null;
|
||||
|
||||
/**
|
||||
* Attributes supported by every block.
|
||||
*
|
||||
* @since 6.0.0
|
||||
* @var array
|
||||
*/
|
||||
const GLOBAL_ATTRIBUTES = array(
|
||||
'lock' => array( 'type' => 'object' ),
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -355,6 +365,18 @@ class WP_Block_Type {
|
|||
|
||||
$args['name'] = $this->name;
|
||||
|
||||
// Setup attributes if needed.
|
||||
if ( ! isset( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) {
|
||||
$args['attributes'] = array();
|
||||
}
|
||||
|
||||
// Register core attributes.
|
||||
foreach ( static::GLOBAL_ATTRIBUTES as $attr_key => $attr_schema ) {
|
||||
if ( ! array_key_exists( $attr_key, $args['attributes'] ) ) {
|
||||
$args['attributes'][ $attr_key ] = $attr_schema;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the arguments for registering a block type.
|
||||
*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta2-53267';
|
||||
$wp_version = '6.0-beta2-53268';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue