Automattic\WooCommerce\Blocks\BlockTypes
ProductTemplate::block_core_post_template_uses_featured_image
Determines whether a block list contains a block that uses the featured image.
Method of the class: ProductTemplate{}
No Hooks.
Returns
true|false
. Whether the block list contains a block that uses the featured image.
Usage
// protected - for code of main (parent) or child class $result = $this->block_core_post_template_uses_featured_image( $inner_blocks );
- $inner_blocks(WP_Block_List) (required)
- Inner block instance.
ProductTemplate::block_core_post_template_uses_featured_image() ProductTemplate::block core post template uses featured image code WC 9.9.4
protected function block_core_post_template_uses_featured_image( $inner_blocks ) { foreach ( $inner_blocks as $block ) { if ( 'core/post-featured-image' === $block->name ) { return true; } if ( 'core/cover' === $block->name && ! empty( $block->attributes['useFeaturedImage'] ) ) { return true; } if ( $block->inner_blocks && block_core_post_template_uses_featured_image( $block->inner_blocks ) ) { return true; } } return false; }