| @@ -23,11 +23,14 @@ | ||
| 23 | 23 | /** |
| 24 | 24 | * Set categories and patterns. |
| 25 | 25 | */ |
| 26 | 26 | public function __construct() { |
| 27 | + $this->categories = [ | |
| 28 | + 'surecart_form' => [ 'label' => __( 'Checkout Form', 'surecart' ) ], | |
| 29 | + ]; | |
| 30 | + | |
| 27 | 31 | $this->patterns = [ |
| 28 | 32 | 'default', |
| 29 | - 'full-page', | |
| 30 | 33 | 'simple', |
| 31 | 34 | 'sections', |
| 32 | 35 | 'two-column', |
| 33 | 36 | 'donation', |
| @@ -47,15 +50,9 @@ | ||
| 47 | 50 | /** |
| 48 | 51 | * Register block patterns and |
| 49 | 52 | */ |
| 50 | 53 | public function registerPatternsAndCategories() { |
| 51 | - $this->categories = [ | |
| 52 | - 'surecart_form' => [ 'label' => __( 'Checkout Form', 'surecart' ) ], | |
| 53 | - 'surecart_shop' => [ 'label' => __( 'Shop', 'surecart' ) ], | |
| 54 | - 'surecart_product_page' => [ 'label' => __( 'Product Page', 'surecart' ) ], | |
| 55 | - 'surecart_related_products' => [ 'label' => __( 'Related Products', 'surecart' ) ], | |
| 56 | - ]; | |
| 57 | - $this->registerCategories(); | |
| 54 | + // $this->registerCategories(); | |
| 58 | 55 | $this->registerPatterns(); |
| 59 | 56 | } |
| 60 | 57 | |
| 61 | 58 | /** |
| @@ -91,28 +88,8 @@ | ||
| 91 | 88 | * |
| 92 | 89 | * @return void |
| 93 | 90 | */ |
| 94 | 91 | public function registerPatterns() { |
| 95 | - // register the block patterns from patterns directory. | |
| 96 | - $patterns = glob( plugin_dir_path( SURECART_PLUGIN_FILE ) . 'templates/patterns/*.php' ); | |
| 97 | - | |
| 98 | - // sort by priority key. | |
| 99 | - usort( | |
| 100 | - $patterns, | |
| 101 | - function ( $a, $b ) { | |
| 102 | - $a = require $a; | |
| 103 | - $b = require $b; | |
| 104 | - return ( $a['priority'] ?? 0 ) <=> ( $b['priority'] ?? 0 ); | |
| 105 | - } | |
| 106 | - ); | |
| 107 | - | |
| 108 | - foreach ( $patterns as $pattern_file ) { | |
| 109 | - register_block_pattern( | |
| 110 | - 'surecart-' . basename( $pattern_file, '.php' ), | |
| 111 | - require $pattern_file | |
| 112 | - ); | |
| 113 | - } | |
| 114 | - | |
| 115 | 92 | /** |
| 116 | 93 | * Filters the plugin block patterns. |
| 117 | 94 | * |
| 118 | 95 | * @param array $patterns List of block patterns by name. |