Skip to content

Commit

Permalink
docblock feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gaambo committed Mar 18, 2024
1 parent 2b44fd4 commit 89b36b7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/compat/wordpress-6.5/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ function gutenberg_filter_render_block_enqueue_view_styles( $block_content, $par

add_filter( 'render_block', 'gutenberg_filter_render_block_enqueue_view_styles', 10, 3 );


/**
* Registers a REST field for block types to provide view styles.
*
* Adds the `view_style_handles` field to block type objects in the REST API, which
* lists the style handles associated with the block's viewStyle key.
*/
function gutenberg_register_view_style_rest_field() {
register_rest_field(
'block-type',
Expand All @@ -307,12 +314,12 @@ function gutenberg_register_view_style_rest_field() {
* Required for core versions < 6.5, since a custom version of generate_block_asset_handle has to be used
* that supports the viewStyle property and correctly creates the handle
*
* @param array $metadata Block metadata.
* @param int $index Optional. Index of the style to register when multiple items passed.
* Default 0.
* @return string|false Style handle provided directly or created through
* style's registration, or false on failure.
*/
* @param array $metadata Block metadata.
* @param int $index Optional. Index of the style to register when multiple items passed.
* Default 0.
* @return string|false Style handle provided directly or created through
* style's registration, or false on failure.
*/
function gutenberg_register_block_view_style_handle( $metadata, $index = 0 ) {
$style_handle = $metadata['viewStyle'];
if ( is_array( $style_handle ) ) {
Expand Down

0 comments on commit 89b36b7

Please sign in to comment.