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

Commit

Permalink
Add checkout-header template to the correct area
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Nov 1, 2023
1 parent 761e3f6 commit 574baae
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Utils/BlockTemplateUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ public static function build_template_result_from_post( $post ) {

/**
* Build a unified template object based on a theme file.
* Important: This method is an almost identical duplicate from wp-includes/block-template-utils.php as it was not intended for public use. It has been modified to build templates from plugins rather than themes.
*
* @internal Important: This method is an almost identical duplicate from wp-includes/block-template-utils.php as it was not intended for public use. It has been modified to build templates from plugins rather than themes.
*
* @param array|object $template_file Theme file.
* @param string $template_type wp_template or wp_template_part.
Expand Down Expand Up @@ -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).
if ( 'wp_template_part' === $template_type ) {
switch ( $template_file->slug ) {
case 'mini-cart':
$template->area = 'mini-cart';
break;
case 'checkout-header':
$template->area = 'header';
break;
}
}
return $template;
}
Expand Down

0 comments on commit 574baae

Please sign in to comment.