Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Set the origin of custom templates to 'plugin' and fix plugin name on REST requests #5375

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Utils/BlockTemplateUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public static function gutenberg_build_template_result_from_post( $post ) {
}
}

if ( 'woocommerce' === $theme ) {
$template->theme = 'woocommerce/woocommerce';
$template->origin = 'plugin';
}

return $template;
}

Expand All @@ -133,7 +138,7 @@ public static function gutenberg_build_template_result_from_file( $template_file
$template_content = file_get_contents( $template_file->path );
$template = new \WP_Block_Template();
$template->id = 'woocommerce//' . $template_file->slug;
$template->theme = 'WooCommerce';
$template->theme = 'woocommerce/woocommerce';
$template->content = self::gutenberg_inject_theme_attribute_in_content( $template_content );
$template->source = 'plugin';
$template->slug = $template_file->slug;
Expand Down