Skip to content

Commit 1212c56

Browse files
committed
Update registration method
1 parent 59936a1 commit 1212c56

File tree

3 files changed

+27
-36
lines changed

3 files changed

+27
-36
lines changed

lib/block-supports/lock.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

lib/compat/wordpress-6.0/blocks.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,30 @@ function ( $response ) {
269269
);
270270
}
271271
add_action( 'rest_api_init', 'gutenberg_rest_comment_set_children_as_embeddable' );
272+
273+
/**
274+
* Registers the lock block attribute for block types.
275+
*
276+
* Once 6.0 is the minimum supported WordPress version for the Gutenberg
277+
* plugin, this shim can be removed
278+
*
279+
* Doesn't need to be backported into Core.
280+
*
281+
* @param array $args Array of arguments for registering a block type.
282+
* @return array $args
283+
*/
284+
function gutenberg_register_lock_attribute( $args ) {
285+
// Setup attributes if needed.
286+
if ( empty( $args['attributes'] ) ) {
287+
$args['attributes'] = array();
288+
}
289+
290+
if ( ! array_key_exists( 'lock', $args['attributes'] ) ) {
291+
$args['attributes']['lock'] = array(
292+
'type' => 'object',
293+
);
294+
}
295+
296+
return $args;
297+
}
298+
add_filter( 'register_block_type_args', 'gutenberg_register_lock_attribute' );

lib/load.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ function gutenberg_is_experiment_enabled( $name ) {
156156
require __DIR__ . '/block-supports/typography.php';
157157
require __DIR__ . '/block-supports/border.php';
158158
require __DIR__ . '/block-supports/layout.php';
159-
require __DIR__ . '/block-supports/lock.php';
160159
require __DIR__ . '/block-supports/spacing.php';
161160
require __DIR__ . '/block-supports/dimensions.php';
162161
require __DIR__ . '/block-supports/duotone.php';

0 commit comments

Comments
 (0)