Fix: fatal error when page contains edited template or template part (https://github.com/woocommerce/woocommerce-blocks/pull/5558)

This commit is contained in:
Tung Du 2022-01-13 17:52:42 +07:00 committed by GitHub
parent a8d979c47b
commit 61afd2b6ce
1 changed files with 5 additions and 1 deletions

View File

@ -144,7 +144,11 @@ class BlockTemplatesController {
return $template;
}
$available_templates = $this->get_block_templates( array( $slug ), $template_type );
$available_templates = $this->get_block_templates_from_woocommerce(
array( $slug ),
$this->get_block_templates_from_db( array( $slug ), $template_type ),
$template_type
);
return ( is_array( $available_templates ) && count( $available_templates ) > 0 )
? BlockTemplateUtils::gutenberg_build_template_result_from_file( $available_templates[0], $available_templates[0]->type )
: $template;