AbstractPageTemplate.php
1 year ago
AbstractTemplate.php
10 months ago
AbstractTemplateCompatibility.php
1 year ago
AbstractTemplatePart.php
2 years ago
AbstractTemplateWithFallback.php
7 months ago
ArchiveProductTemplatesCompatibility.php
1 year ago
CartTemplate.php
10 months ago
CheckoutHeaderTemplate.php
2 years ago
CheckoutTemplate.php
10 months ago
ClassicTemplatesCompatibility.php
1 year ago
ComingSoonSocialLinksTemplate.php
1 year ago
ComingSoonTemplate.php
1 year ago
ExternalProductAddToCartWithOptionsTemplate.php
1 year ago
GroupedProductAddToCartWithOptionsTemplate.php
1 year ago
MiniCartTemplate.php
2 years ago
OrderConfirmationTemplate.php
1 year ago
ProductAttributeTemplate.php
7 months ago
ProductBrandTemplate.php
7 months ago
ProductCatalogTemplate.php
7 months ago
ProductCategoryTemplate.php
7 months ago
ProductSearchResultsTemplate.php
7 months ago
ProductTagTemplate.php
7 months ago
SimpleProductAddToCartWithOptionsTemplate.php
1 year ago
SingleProductTemplate.php
2 months ago
SingleProductTemplateCompatibility.php
10 months ago
VariableProductAddToCartWithOptionsTemplate.php
1 year ago
MiniCartTemplate.php
67 lines
| 1 | <?php |
| 2 | namespace Automattic\WooCommerce\Blocks\Templates; |
| 3 | |
| 4 | /** |
| 5 | * MiniCartTemplate class. |
| 6 | * |
| 7 | * @internal |
| 8 | */ |
| 9 | class MiniCartTemplate extends AbstractTemplatePart { |
| 10 | |
| 11 | /** |
| 12 | * The slug of the template. |
| 13 | * |
| 14 | * @var string |
| 15 | */ |
| 16 | const SLUG = 'mini-cart'; |
| 17 | |
| 18 | /** |
| 19 | * The template part area where the template part belongs. |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | public $template_area = 'mini-cart'; |
| 24 | |
| 25 | /** |
| 26 | * Initialization method. |
| 27 | */ |
| 28 | public function init() { |
| 29 | add_filter( 'default_wp_template_part_areas', array( $this, 'register_mini_cart_template_part_area' ), 10, 1 ); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Returns the title of the template. |
| 34 | * |
| 35 | * @return string |
| 36 | */ |
| 37 | public function get_template_title() { |
| 38 | return _x( 'Mini-Cart', 'Template name', 'woocommerce' ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Returns the description of the template. |
| 43 | * |
| 44 | * @return string |
| 45 | */ |
| 46 | public function get_template_description() { |
| 47 | return __( 'Template used to display the Mini-Cart drawer.', 'woocommerce' ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Add Mini-Cart to the default template part areas. |
| 52 | * |
| 53 | * @param array $default_area_definitions An array of supported area objects. |
| 54 | * @return array The supported template part areas including the Mini-Cart one. |
| 55 | */ |
| 56 | public function register_mini_cart_template_part_area( $default_area_definitions ) { |
| 57 | $mini_cart_template_part_area = array( |
| 58 | 'area' => 'mini-cart', |
| 59 | 'label' => __( 'Mini-Cart', 'woocommerce' ), |
| 60 | 'description' => __( 'The Mini-Cart template allows shoppers to see their cart items and provides access to the Cart and Checkout pages.', 'woocommerce' ), |
| 61 | 'icon' => 'mini-cart', |
| 62 | 'area_tag' => 'mini-cart', |
| 63 | ); |
| 64 | return array_merge( $default_area_definitions, array( $mini_cart_template_part_area ) ); |
| 65 | } |
| 66 | } |
| 67 |