Automattic\WooCommerce\Admin\Features\ProductBlockEditor
BlockTemplateUtils::get_template_file_data()
Get the template data from the headers.
Method of the class: BlockTemplateUtils{}
No Hooks.
Return
Array
. Template data.
Usage
$result = BlockTemplateUtils::get_template_file_data( $file_path );
- $file_path(string) (required)
- - File path.
BlockTemplateUtils::get_template_file_data() BlockTemplateUtils::get template file data code WC 9.7.1
public static function get_template_file_data( $file_path ) { if ( ! file_exists( $file_path ) ) { return array(); } $file_data = get_file_data( $file_path, array( 'title' => 'Title', 'slug' => 'Slug', 'description' => 'Description', 'product_types' => 'Product Types', ), ); $file_data['product_types'] = explode( ',', trim( $file_data['product_types'] ) ); return $file_data; }