diff --git a/inc/block-patterns.php b/inc/block-patterns.php index e3b6d4fa..300fb072 100644 --- a/inc/block-patterns.php +++ b/inc/block-patterns.php @@ -12,28 +12,35 @@ * @since Twenty Twenty-Two 1.0 */ function twentytwentytwo_register_block_patterns() { - - register_block_pattern_category( - 'twentytwentytwo-general', - array( 'label' => __( 'Twenty Twenty-Two General', 'twentytwentytwo' ) ) - ); - register_block_pattern_category( - 'twentytwentytwo-footers', - array( 'label' => __( 'Twenty Twenty-Two Footers', 'twentytwentytwo' ) ) - ); - register_block_pattern_category( - 'twentytwentytwo-headers', - array( 'label' => __( 'Twenty Twenty-Two Headers', 'twentytwentytwo' ) ) - ); - register_block_pattern_category( - 'twentytwentytwo-query', - array( 'label' => __( 'Twenty Twenty-Two Posts', 'twentytwentytwo' ) ) - ); - register_block_pattern_category( - 'twentytwentytwo-pages', - array( 'label' => __( 'Twenty Twenty-Two Pages', 'twentytwentytwo' ) ) + $block_pattern_categories = array( + 'twentytwentytwo-general' => array( 'label' => __( 'Twenty Twenty-Two General', 'twentytwentytwo' ) ), + 'twentytwentytwo-footers' => array( 'label' => __( 'Twenty Twenty-Two Footers', 'twentytwentytwo' ) ), + 'twentytwentytwo-headers' => array( 'label' => __( 'Twenty Twenty-Two Headers', 'twentytwentytwo' ) ), + 'twentytwentytwo-query' => array( 'label' => __( 'Twenty Twenty-Two Posts', 'twentytwentytwo' ) ), + 'twentytwentytwo-pages' => array( 'label' => __( 'Twenty Twenty-Two Pages', 'twentytwentytwo' ) ), ); + /** + * Filters the theme block pattern categories. + * + * @since Twenty Twenty-Two 1.0 + * + * @param array[] $block_pattern_categories { + * An associative array of block pattern categories, keyed by category name. + * + * @type array[] $properties { + * An array of block category properties. + * + * @type string $label A human-readable label for the pattern category. + * } + * } + */ + $block_pattern_categories = apply_filters( 'twentytwentytwo_block_pattern_categories', $block_pattern_categories ); + + foreach ( $block_pattern_categories as $name => $properties ) { + register_block_pattern_category( $name, $properties ); + } + $block_patterns = array( 'footer-default', 'footer-dark', @@ -104,6 +111,15 @@ function twentytwentytwo_register_block_patterns() { 'query-irregular-grid', ); + /** + * Filters the theme block patterns. + * + * @since Twenty Twenty-Two 1.0 + * + * @param $block_patterns array List of block patterns by name. + */ + $block_patterns = apply_filters( 'twentytwentytwo_block_patterns', $block_patterns ); + foreach ( $block_patterns as $block_pattern ) { register_block_pattern( 'twentytwentytwo/' . $block_pattern,