From c7f2e09f014f3d0c4e817c985104594663b92f28 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Sun, 5 Dec 2021 16:06:06 +0100 Subject: [PATCH 1/4] Docs: Don't align @param and @return tags --- packages/block-library/src/image/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index c3f22c04571553..f8f7066a970d88 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -11,7 +11,7 @@ * * @param array $attributes The block attributes. * @param array $content The block content. - * @return string Returns the block content with the data-id attribute added. + * @return string Returns the block content with the data-id attribute added. */ function render_block_core_image( $attributes, $content ) { if ( isset( $attributes['data-id'] ) ) { From 0833877ab63ac9e599e4187e8ffdda9307e1127e Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Sun, 5 Dec 2021 16:06:51 +0100 Subject: [PATCH 2/4] Remove gutenberg_ prefix for register_block_core_gallery() --- packages/block-library/src/gallery/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index a9765c344323ab..2df442bdbd1f1e 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -38,7 +38,7 @@ function render_block_core_gallery_data( $parsed_block ) { * This render callback needs to be here * so that the gallery styles are loaded in block-based themes. */ -function gutenberg_register_block_core_gallery() { +function register_block_core_gallery() { register_block_type_from_metadata( __DIR__ . '/gallery', array( @@ -49,4 +49,4 @@ function gutenberg_register_block_core_gallery() { ); } -add_action( 'init', 'gutenberg_register_block_core_gallery', 20 ); +add_action( 'init', 'register_block_core_gallery', 20 ); From 1420af4085589920970e18ca6ad96ec0a55f0ce4 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Sun, 5 Dec 2021 16:07:16 +0100 Subject: [PATCH 3/4] Fix typo and docs formatting --- packages/block-library/src/gallery/index.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index 2df442bdbd1f1e..15b120e2286016 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -1,6 +1,6 @@ Date: Sun, 5 Dec 2021 16:07:57 +0100 Subject: [PATCH 4/4] Rename function for clarity and to match similar functions Example: block_core_navigation_typographic_presets_backcompatibility() --- packages/block-library/src/gallery/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index 15b120e2286016..a159de4df173e8 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -16,7 +16,7 @@ * @param array $parsed_block The block being rendered. * @return array The migrated block object. */ -function render_block_core_gallery_data( $parsed_block ) { +function block_core_gallery_data_id_backcompatibility( $parsed_block ) { if ( 'core/gallery' === $parsed_block['blockName'] ) { foreach ( $parsed_block['innerBlocks'] as $key => $inner_block ) { if ( 'core/image' === $inner_block['blockName'] ) { @@ -30,7 +30,7 @@ function render_block_core_gallery_data( $parsed_block ) { return $parsed_block; } -add_filter( 'render_block_data', 'render_block_core_gallery_data' ); +add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' ); /** * Registers the `core/gallery` block on server.