From 5422714b7e0685697fb6b64394a04d223c23d23c Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 25 Jan 2022 11:59:20 +1300 Subject: [PATCH] Add doc comment to new render callback --- packages/block-library/src/gallery/index.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index 09875db4279286..e73a092e88067e 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -32,6 +32,17 @@ function block_core_gallery_data_id_backcompatibility( $parsed_block ) { add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' ); +/** + * Adds a style tag for the --wp--style--unstable-gallery-gap var. + * + * The Gallery block needs to recalculate Image block width based on + * the current gap setting in order to maintain the number of flex columns + * so a css var is added to allow this. + * + * @param array $attributes Attributes of the block being rendered. + * @param string $content Content of the block being rendered. + * @return string The content of the block being rendered. + */ function block_core_gallery_render( $attributes, $content ) { $gap_value = _wp_array_get( $attributes, array( 'style', 'spacing', 'blockGap' ) ); // Skip if gap value contains unsupported characters.