Automattic\WooCommerce\Blocks\Utils
BlockTemplateUtils::get_block_template_area
Returns area for template parts.
Method of the class: BlockTemplateUtils{}
No Hooks.
Returns
String. Template part area.
Usage
$result = BlockTemplateUtils::get_block_template_area( $template_slug, $template_type );
- $template_slug(string) (required)
- The template part slug (e.g. mini-cart).
- $template_type(string) (required)
- Either
wp_templateorwp_template_part.
BlockTemplateUtils::get_block_template_area() BlockTemplateUtils::get block template area code WC 10.6.2
public static function get_block_template_area( $template_slug, $template_type ) {
if ( 'wp_template_part' === $template_type ) {
$registered_template = self::get_template( $template_slug );
if ( $registered_template && property_exists( $registered_template, 'template_area' ) ) {
return $registered_template->template_area;
}
}
return 'uncategorized';
}