Automattic\WooCommerce\Blocks\Templates
AbstractTemplateCompatibility::current_template_has_legacy_template_block
Check if the current template has a legacy template block.
Method of the class: AbstractTemplateCompatibility{}
No Hooks.
Returns
true|false. True if the current template has a legacy template block, false otherwise.
Usage
$AbstractTemplateCompatibility = new AbstractTemplateCompatibility(); $AbstractTemplateCompatibility->current_template_has_legacy_template_block();
AbstractTemplateCompatibility::current_template_has_legacy_template_block() AbstractTemplateCompatibility::current template has legacy template block code WC 11.0.1
public function current_template_has_legacy_template_block() {
global $_wp_current_template_id;
if ( empty( $_wp_current_template_id ) ) {
return false;
}
$current_template = get_block_template( $_wp_current_template_id, 'wp_template' );
if ( isset( $current_template ) && BlockTemplateUtils::template_has_legacy_template_block( $current_template ) ) {
return true;
}
return false;
}