Automattic\WooCommerce\Admin\Features\ProductBlockEditor

BlockTemplateUtils::get_template_content()public staticWC 1.0

Get the template content from the file.

Method of the class: BlockTemplateUtils{}

No Hooks.

Return

String. Content.

Usage

$result = BlockTemplateUtils::get_template_content( $file_path );
$file_path(string) (required)
- File path.

BlockTemplateUtils::get_template_content() code WC 9.7.1

public static function get_template_content( $file_path ) {
	if ( ! file_exists( $file_path ) ) {
		return '';
	}

	ob_start();
	include $file_path;
	$content = ob_get_contents();
	ob_end_clean();

	return $content;
}