Automattic\WooCommerce\Blocks\Utils
BlockTemplateUtils::template_has_legacy_template_block()
Returns whether the passed $template has the legacy template block.
Method of the class: BlockTemplateUtils{}
No Hooks.
Return
true|false
.
Usage
$result = BlockTemplateUtils::template_has_legacy_template_block( $template );
- $template(object) (required)
- The template object.
BlockTemplateUtils::template_has_legacy_template_block() BlockTemplateUtils::template has legacy template block code WC 9.4.2
public static function template_has_legacy_template_block( $template ) { if ( has_block( 'woocommerce/legacy-template', $template->content ) ) { return true; } $blocks = parse_blocks( $template->content ); return self::has_block_including_patterns( array( 'woocommerce/legacy-template' ), $blocks ); }