class-patterns.php
28 lines
| 1 | <?php |
| 2 | declare(strict_types = 1); |
| 3 | namespace Automattic\WooCommerce\EmailEditor\Engine\Patterns; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | class Patterns { |
| 6 | public function initialize(): void { |
| 7 | $this->register_block_pattern_categories(); |
| 8 | } |
| 9 | private function register_block_pattern_categories(): void { |
| 10 | $categories = array( |
| 11 | array( |
| 12 | 'name' => 'email-contents', |
| 13 | 'label' => _x( 'Email Contents', 'Block pattern category', 'woocommerce' ), |
| 14 | 'description' => __( 'A collection of email content layouts.', 'woocommerce' ), |
| 15 | ), |
| 16 | ); |
| 17 | foreach ( $categories as $category ) { |
| 18 | register_block_pattern_category( |
| 19 | $category['name'], |
| 20 | array( |
| 21 | 'label' => $category['label'], |
| 22 | 'description' => $category['description'] ?? '', |
| 23 | ) |
| 24 | ); |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 |