Add missing page titles in Cart and Checkout templates (https://github.com/woocommerce/woocommerce-blocks/pull/10281)
* Add missing page titles to the Cart and Checkout templates * Adjust headline level * Add i18n support for Cart and Checkout template titles * Keep empty line between “wp:group” and “wp:template-part” * Add empty line between “wp:template-part” and “wp:group”
This commit is contained in:
parent
6e10e2fbcb
commit
ebf4bef204
|
@ -40,6 +40,14 @@ class Cart extends AbstractBlock {
|
|||
public function register_patterns() {
|
||||
$shop_permalink = wc_get_page_id( 'shop' ) ? get_permalink( wc_get_page_id( 'shop' ) ) : '';
|
||||
|
||||
register_block_pattern(
|
||||
'woocommerce/cart-heading',
|
||||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"align":"wide", "level":1} --><h1 class="wp-block-heading alignwide">' . esc_html__( 'Cart', 'woo-gutenberg-products-block' ) . '</h1><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
register_block_pattern(
|
||||
'woocommerce/cart-cross-sells-message',
|
||||
array(
|
||||
|
|
|
@ -24,6 +24,31 @@ class Checkout extends AbstractBlock {
|
|||
*/
|
||||
protected $chunks_folder = 'checkout-blocks';
|
||||
|
||||
/**
|
||||
* Initialize this block type.
|
||||
*
|
||||
* - Hook into WP lifecycle.
|
||||
* - Register the block with WordPress.
|
||||
*/
|
||||
protected function initialize() {
|
||||
parent::initialize();
|
||||
add_action( 'wp_loaded', array( $this, 'register_patterns' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register block pattern for Empty Cart Message to make it translatable.
|
||||
*/
|
||||
public function register_patterns() {
|
||||
register_block_pattern(
|
||||
'woocommerce/checkout-heading',
|
||||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"align":"wide", "level":1} --><h1 class="wp-block-heading alignwide">' . esc_html__( 'Checkout', 'woo-gutenberg-products-block' ) . '</h1><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the editor script handle for this block type.
|
||||
*
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
||||
|
||||
<!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
|
||||
<div class="wp-block-group"><!-- wp:woocommerce/cart -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:pattern {"slug":"woocommerce/cart-heading"} /-->
|
||||
|
||||
<!-- wp:woocommerce/cart -->
|
||||
<div class="wp-block-woocommerce-cart alignwide is-loading">
|
||||
<!-- wp:woocommerce/filled-cart-block {"align":"wide"} -->
|
||||
<div class="wp-block-woocommerce-filled-cart-block alignwide">
|
||||
|
@ -161,4 +165,5 @@
|
|||
<!-- /wp:woocommerce/cart -->
|
||||
</div>
|
||||
<!-- /wp:group -->
|
||||
<!-- wp:template-part {"slug":"footer"} /-->
|
||||
|
||||
<!-- wp:template-part {"slug":"footer"} /-->
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<!-- wp:template-part {"slug":"checkout-header","theme":"woocommerce/woocommerce"} /-->
|
||||
|
||||
<!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
|
||||
<div class="wp-block-group"><!-- wp:woocommerce/checkout {"className":"wc-block-checkout"} -->
|
||||
<div class="wp-block-woocommerce-checkout alignwide wc-block-checkout is-loading"><!-- wp:woocommerce/checkout-fields-block -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:pattern {"slug":"woocommerce/checkout-heading"} /-->
|
||||
|
||||
<!-- wp:woocommerce/checkout {"className":"wc-block-checkout"} -->
|
||||
<div class="wp-block-woocommerce-checkout alignwide wc-block-checkout is-loading">
|
||||
<!-- wp:woocommerce/checkout-fields-block -->
|
||||
<div class="wp-block-woocommerce-checkout-fields-block"><!-- wp:woocommerce/checkout-express-payment-block -->
|
||||
<div class="wp-block-woocommerce-checkout-express-payment-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-express-payment-block -->
|
||||
|
@ -44,12 +49,14 @@
|
|||
|
||||
<!-- wp:woocommerce/checkout-actions-block -->
|
||||
<div class="wp-block-woocommerce-checkout-actions-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-actions-block --></div>
|
||||
<!-- /wp:woocommerce/checkout-actions-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout-fields-block -->
|
||||
|
||||
<!-- wp:woocommerce/checkout-totals-block -->
|
||||
<div class="wp-block-woocommerce-checkout-totals-block"><!-- wp:woocommerce/checkout-order-summary-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-block"><!-- wp:woocommerce/checkout-order-summary-cart-items-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-block">
|
||||
<!-- wp:woocommerce/checkout-order-summary-cart-items-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-cart-items-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-cart-items-block -->
|
||||
|
||||
|
@ -75,8 +82,12 @@
|
|||
|
||||
<!-- wp:woocommerce/checkout-order-summary-taxes-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-taxes-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-taxes-block --></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-block --></div>
|
||||
<!-- /wp:woocommerce/checkout-totals-block --></div>
|
||||
<!-- /wp:woocommerce/checkout --></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-taxes-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout-totals-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout -->
|
||||
</div>
|
||||
<!-- /wp:group -->
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
||||
|
||||
<!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
|
||||
<div class="wp-block-group"><!-- wp:woocommerce/cart -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:pattern {"slug":"woocommerce/cart-heading"} /-->
|
||||
|
||||
<!-- wp:woocommerce/cart -->
|
||||
<div class="wp-block-woocommerce-cart alignwide is-loading">
|
||||
<!-- wp:woocommerce/filled-cart-block {"align":"wide"} -->
|
||||
<div class="wp-block-woocommerce-filled-cart-block alignwide">
|
||||
|
@ -161,4 +165,5 @@
|
|||
<!-- /wp:woocommerce/cart -->
|
||||
</div>
|
||||
<!-- /wp:group -->
|
||||
<!-- wp:template-part {"slug":"footer"} /-->
|
||||
|
||||
<!-- wp:template-part {"slug":"footer"} /-->
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<!-- wp:template-part {"slug":"checkout-header","theme":"woocommerce/woocommerce"} /-->
|
||||
|
||||
<!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
|
||||
<div class="wp-block-group"><!-- wp:woocommerce/checkout {"className":"wc-block-checkout"} -->
|
||||
<div class="wp-block-woocommerce-checkout alignwide wc-block-checkout is-loading"><!-- wp:woocommerce/checkout-fields-block -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:pattern {"slug":"woocommerce/checkout-heading"} /-->
|
||||
|
||||
<!-- wp:woocommerce/checkout {"className":"wc-block-checkout"} -->
|
||||
<div class="wp-block-woocommerce-checkout alignwide wc-block-checkout is-loading">
|
||||
<!-- wp:woocommerce/checkout-fields-block -->
|
||||
<div class="wp-block-woocommerce-checkout-fields-block"><!-- wp:woocommerce/checkout-express-payment-block -->
|
||||
<div class="wp-block-woocommerce-checkout-express-payment-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-express-payment-block -->
|
||||
|
@ -44,12 +49,14 @@
|
|||
|
||||
<!-- wp:woocommerce/checkout-actions-block -->
|
||||
<div class="wp-block-woocommerce-checkout-actions-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-actions-block --></div>
|
||||
<!-- /wp:woocommerce/checkout-actions-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout-fields-block -->
|
||||
|
||||
<!-- wp:woocommerce/checkout-totals-block -->
|
||||
<div class="wp-block-woocommerce-checkout-totals-block"><!-- wp:woocommerce/checkout-order-summary-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-block"><!-- wp:woocommerce/checkout-order-summary-cart-items-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-block">
|
||||
<!-- wp:woocommerce/checkout-order-summary-cart-items-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-cart-items-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-cart-items-block -->
|
||||
|
||||
|
@ -75,8 +82,12 @@
|
|||
|
||||
<!-- wp:woocommerce/checkout-order-summary-taxes-block -->
|
||||
<div class="wp-block-woocommerce-checkout-order-summary-taxes-block"></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-taxes-block --></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-block --></div>
|
||||
<!-- /wp:woocommerce/checkout-totals-block --></div>
|
||||
<!-- /wp:woocommerce/checkout --></div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-taxes-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout-order-summary-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout-totals-block -->
|
||||
</div>
|
||||
<!-- /wp:woocommerce/checkout -->
|
||||
</div>
|
||||
<!-- /wp:group -->
|
||||
|
|
Loading…
Reference in New Issue