Automattic\WooCommerce\Blocks\Templates
SingleProductTemplateCompatibility::create_wrap_block_group()
Wrap all the blocks inside the template in a group block.
Method of the class: SingleProductTemplateCompatibility{}
No Hooks.
Return
Array
. Group block with the blocks inside.
Usage
$result = SingleProductTemplateCompatibility::create_wrap_block_group( $blocks );
- $blocks(array) (required)
- Array of parsed block objects.
SingleProductTemplateCompatibility::create_wrap_block_group() SingleProductTemplateCompatibility::create wrap block group code WC 9.4.2
private static function create_wrap_block_group( $blocks ) { $serialized_blocks = serialize_blocks( $blocks ); $new_block = parse_blocks( sprintf( '<!-- wp:group {"className":"woocommerce product"} --> <div class="wp-block-group woocommerce product"> %1$s </div> <!-- /wp:group -->', $serialized_blocks ) ); $new_block['innerBlocks'] = $blocks; return $new_block; }