class-patterns.php
48 lines
| 1 | <?php |
| 2 | /** |
| 3 | * This file is part of the WooCommerce Email Editor package. |
| 4 | * |
| 5 | * @package Automattic\WooCommerce\EmailEditor |
| 6 | */ |
| 7 | |
| 8 | declare(strict_types = 1); |
| 9 | namespace Automattic\WooCommerce\EmailEditor\Engine\Patterns; |
| 10 | |
| 11 | /** |
| 12 | * Register block patterns. |
| 13 | */ |
| 14 | class Patterns { |
| 15 | /** |
| 16 | * Initialize block patterns. |
| 17 | * |
| 18 | * @return void |
| 19 | */ |
| 20 | public function initialize(): void { |
| 21 | $this->register_block_pattern_categories(); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Register block pattern category. |
| 26 | * |
| 27 | * @return void |
| 28 | */ |
| 29 | private function register_block_pattern_categories(): void { |
| 30 | $categories = array( |
| 31 | array( |
| 32 | 'name' => 'email-contents', |
| 33 | 'label' => _x( 'Email Contents', 'Block pattern category', 'woocommerce' ), |
| 34 | 'description' => __( 'A collection of email content layouts.', 'woocommerce' ), |
| 35 | ), |
| 36 | ); |
| 37 | foreach ( $categories as $category ) { |
| 38 | register_block_pattern_category( |
| 39 | $category['name'], |
| 40 | array( |
| 41 | 'label' => $category['label'], |
| 42 | 'description' => $category['description'] ?? '', |
| 43 | ) |
| 44 | ); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 |