Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::get_templates_directorypublic staticWC 1.0

Gets the directory where templates of a specific template type can be found.

Method of the class: BlockTemplateUtils{}

No Hooks.

Returns

String.

Usage

$result = BlockTemplateUtils::get_templates_directory( $template_type );
$template_type(string)
wp_template or wp_template_part.
Default: 'wp_template'

BlockTemplateUtils::get_templates_directory() code WC 11.0.1

public static function get_templates_directory( $template_type = 'wp_template' ) {
		$root_path                = dirname( __DIR__, 3 ) . '/' . self::TEMPLATES_ROOT_DIR . DIRECTORY_SEPARATOR;
		$templates_directory      = $root_path . self::DIRECTORY_NAMES['TEMPLATES'];
		$template_parts_directory = $root_path . self::DIRECTORY_NAMES['TEMPLATE_PARTS'];

	if ( 'wp_template_part' === $template_type ) {
		return $template_parts_directory;
	}

	if ( self::should_use_blockified_product_grid_templates() ) {
		return $templates_directory . '/blockified';
	}

	return $templates_directory;
}