Skip to content

Commit

Permalink
Update registration method
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Apr 20, 2022
1 parent 59936a1 commit 1212c56
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 36 deletions.
35 changes: 0 additions & 35 deletions lib/block-supports/lock.php

This file was deleted.

27 changes: 27 additions & 0 deletions lib/compat/wordpress-6.0/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,30 @@ function ( $response ) {
);
}
add_action( 'rest_api_init', 'gutenberg_rest_comment_set_children_as_embeddable' );

/**
* Registers the lock block attribute for block types.
*
* Once 6.0 is the minimum supported WordPress version for the Gutenberg
* plugin, this shim can be removed
*
* Doesn't need to be backported into Core.
*
* @param array $args Array of arguments for registering a block type.
* @return array $args
*/
function gutenberg_register_lock_attribute( $args ) {
// Setup attributes if needed.
if ( empty( $args['attributes'] ) ) {
$args['attributes'] = array();
}

if ( ! array_key_exists( 'lock', $args['attributes'] ) ) {
$args['attributes']['lock'] = array(
'type' => 'object',
);
}

return $args;
}
add_filter( 'register_block_type_args', 'gutenberg_register_lock_attribute' );
1 change: 0 additions & 1 deletion lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/block-supports/typography.php';
require __DIR__ . '/block-supports/border.php';
require __DIR__ . '/block-supports/layout.php';
require __DIR__ . '/block-supports/lock.php';
require __DIR__ . '/block-supports/spacing.php';
require __DIR__ . '/block-supports/dimensions.php';
require __DIR__ . '/block-supports/duotone.php';

0 comments on commit 1212c56

Please sign in to comment.