-
Notifications
You must be signed in to change notification settings - Fork 219
Add checkout-header template to the correct area in site editor #11528
Conversation
When this class is refactored, move title, description, a...When this class is refactored, move title, description, and area definition to the template classes (CheckoutHeaderTemplate, MiniCartTemplate, etc).
woocommerce-blocks/src/Utils/BlockTemplateUtils.php Lines 227 to 238 in 574baae
🚀 This comment was generated by the automations bot based on a
|
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.53 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! 🎉
I just left a non-blocking suggestion. I'd love to hear your thoughts around it.
@@ -223,8 +224,16 @@ public static function build_template_result_from_file( $template_file, $templat | |||
$template->area = 'uncategorized'; | |||
|
|||
// Force the Mini-Cart template part to be in the Mini-Cart template part area. | |||
if ( 'wp_template_part' === $template_type && 'mini-cart' === $template_file->slug ) { | |||
$template->area = 'mini-cart'; | |||
// @todo When this class is refactored, move title, description, and area definition to the template classes (CheckoutHeaderTemplate, MiniCartTemplate, etc). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering if we can refactor the code into a function, allowing us to reuse it for other templates.
function getTemplateAreaBySlug($slug) {
$areas = [
'mini-cart' => 'mini-cart',
'checkout-header' => 'header'
];
return $areas[$slug] ?? 'uncategorized';
}
if ('wp_template_part' === $template_type) {
$template->area = getTemplateAreaBySlug($template_file->slug);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but origami are going to be refactoring all of this soon so best we don't touch it at this point.
What
Adds the checkout-header template part under the "header" area in the site editor.
Why
Organisation.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog