-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block Locking: Register the 'lock' attribute on the server
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* Spacing block support flag. | ||
* | ||
* Once 6.0 is the minimum supported WordPress version for the Gutenberg | ||
* plugin, this shim can be removed | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
/** | ||
* Registers the lock block attribute for block types. | ||
* | ||
* @param WP_Block_Type $block_type Block Type. | ||
*/ | ||
function gutenberg_register_lock_support( $block_type ) { | ||
// Setup attributes if needed. | ||
if ( ! $block_type->attributes ) { | ||
$block_type->attributes = array(); | ||
} | ||
|
||
if ( ! array_key_exists( 'lock', $block_type->attributes ) ) { | ||
$block_type->attributes['lock'] = array( | ||
'type' => 'object', | ||
); | ||
} | ||
} | ||
|
||
// Register the block support. | ||
WP_Block_Supports::get_instance()->register( | ||
'lock', | ||
array( | ||
'register_attribute' => 'gutenberg_register_lock_support', | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters