From ded17961821c58198123b98010792194c6ae4af4 Mon Sep 17 00:00:00 2001 From: Kjell Reigstad Date: Tue, 20 Apr 2021 08:39:20 -0400 Subject: [PATCH 1/5] Block Pattern Cleanup --- lib/block-patterns.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 3c3695d4ac049a..7fc14bbdd6aadd 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -5,7 +5,10 @@ * @package gutenberg */ -register_block_pattern_category( 'Query', array( 'label' => __( 'Query', 'gutenberg' ) ) ); +// Register categories used for block patterns. +register_block_pattern_category( 'query', array( 'label' => __( 'Query', 'gutenberg' ) ) ); +register_block_pattern_category( 'text', array( 'label' => __( 'Text', 'gutenberg' ) ) ); +register_block_pattern_category( 'buttons', array( 'label' => __( 'Buttons', 'gutenberg' ) ) ); // Initial Query block patterns. register_block_pattern( @@ -13,7 +16,7 @@ array( 'title' => __( 'Standard', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), - 'categories' => array( 'Query' ), + 'categories' => array( 'query' ), 'content' => ' @@ -33,7 +36,7 @@ array( 'title' => __( 'Image at Left', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), - 'categories' => array( 'Query' ), + 'categories' => array( 'query' ), 'content' => ' @@ -55,7 +58,7 @@ array( 'title' => __( 'Small Image and Title', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), - 'categories' => array( 'Query' ), + 'categories' => array( 'query' ), 'content' => ' @@ -76,7 +79,7 @@ array( 'title' => __( 'Grid', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), - 'categories' => array( 'Query' ), + 'categories' => array( 'query' ), 'content' => ' @@ -94,7 +97,7 @@ array( 'title' => __( 'Large Title', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), - 'categories' => array( 'Query' ), + 'categories' => array( 'query' ), 'content' => '
@@ -122,7 +125,7 @@ array( 'title' => __( 'Offset', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), - 'categories' => array( 'Query' ), + 'categories' => array( 'query' ), 'content' => '
@@ -159,7 +162,7 @@ 'paragraph/large-with-background-color', array( 'title' => __( 'Large Paragraph with background color', 'gutenberg' ), - 'categories' => array( 'Text' ), + 'categories' => array( 'text' ), 'blockTypes' => array( 'core/paragraph' ), 'viewportWidth' => 500, 'content' => ' @@ -171,7 +174,7 @@ 'social-links/shared-background-color', array( 'title' => __( 'Social links with a shared background color', 'gutenberg' ), - 'categories' => array( 'Buttons' ), + 'categories' => array( 'buttons' ), 'blockTypes' => array( 'core/social-links' ), 'viewportWidth' => 500, 'content' => ' @@ -227,11 +230,9 @@ function() { unregister_block_pattern( 'core/' . $core_block_pattern ); } - register_block_pattern_category( 'buttons', array( 'label' => _x( 'Buttons', 'Block pattern category', 'default' ) ) ); register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category', 'default' ) ) ); register_block_pattern_category( 'header', array( 'label' => _x( 'Headers', 'Block pattern category', 'default' ) ) ); register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category', 'default' ) ) ); - register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category', 'default' ) ) ); foreach ( $new_core_block_patterns as $core_block_pattern ) { register_block_pattern( From 008c020c1f163c43943c6ee8f5d6d407080cdfc9 Mon Sep 17 00:00:00 2001 From: Kjell Reigstad Date: Tue, 20 Apr 2021 08:44:04 -0400 Subject: [PATCH 2/5] Update pattern title to use sentence case. --- lib/block-patterns.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 7fc14bbdd6aadd..269e4b1bfa283f 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -161,7 +161,7 @@ register_block_pattern( 'paragraph/large-with-background-color', array( - 'title' => __( 'Large Paragraph with background color', 'gutenberg' ), + 'title' => __( 'Large paragraph with background color', 'gutenberg' ), 'categories' => array( 'text' ), 'blockTypes' => array( 'core/paragraph' ), 'viewportWidth' => 500, From 0baf3694be0e6d8c1836c5bce4650c9dce9a4084 Mon Sep 17 00:00:00 2001 From: Kjell Reigstad Date: Tue, 20 Apr 2021 08:50:41 -0400 Subject: [PATCH 3/5] Change titles to sentence case. --- lib/block-patterns.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 269e4b1bfa283f..7ddb704a63375f 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -34,7 +34,7 @@ register_block_pattern( 'query/medium-posts', array( - 'title' => __( 'Image at Left', 'gutenberg' ), + 'title' => __( 'Image at left', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), 'categories' => array( 'query' ), 'content' => ' @@ -56,7 +56,7 @@ register_block_pattern( 'query/small-posts', array( - 'title' => __( 'Small Image and Title', 'gutenberg' ), + 'title' => __( 'Small image and title', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), 'categories' => array( 'query' ), 'content' => ' @@ -95,7 +95,7 @@ register_block_pattern( 'query/large-title-posts', array( - 'title' => __( 'Large Title', 'gutenberg' ), + 'title' => __( 'Large title', 'gutenberg' ), 'blockTypes' => array( 'core/query' ), 'categories' => array( 'query' ), 'content' => ' From a50313d3824dd886f958baf1fb474084872459bb Mon Sep 17 00:00:00 2001 From: Maggie Cabrera Date: Tue, 20 Apr 2021 15:03:24 +0200 Subject: [PATCH 4/5] linting --- lib/block-patterns.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 7ddb704a63375f..61519a1b64e0c2 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -5,7 +5,7 @@ * @package gutenberg */ -// Register categories used for block patterns. +// Register categories used for block patterns. register_block_pattern_category( 'query', array( 'label' => __( 'Query', 'gutenberg' ) ) ); register_block_pattern_category( 'text', array( 'label' => __( 'Text', 'gutenberg' ) ) ); register_block_pattern_category( 'buttons', array( 'label' => __( 'Buttons', 'gutenberg' ) ) ); From 3c3cea81ca37094f1a4a6e8f66eb30a0306f38a5 Mon Sep 17 00:00:00 2001 From: Kjell Reigstad Date: Tue, 20 Apr 2021 11:13:06 -0400 Subject: [PATCH 5/5] Remove duplicate pattern categories. --- lib/block-patterns.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 61519a1b64e0c2..ab8c9ffa6e320e 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -7,8 +7,6 @@ // Register categories used for block patterns. register_block_pattern_category( 'query', array( 'label' => __( 'Query', 'gutenberg' ) ) ); -register_block_pattern_category( 'text', array( 'label' => __( 'Text', 'gutenberg' ) ) ); -register_block_pattern_category( 'buttons', array( 'label' => __( 'Buttons', 'gutenberg' ) ) ); // Initial Query block patterns. register_block_pattern( @@ -230,10 +228,6 @@ function() { unregister_block_pattern( 'core/' . $core_block_pattern ); } - register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category', 'default' ) ) ); - register_block_pattern_category( 'header', array( 'label' => _x( 'Headers', 'Block pattern category', 'default' ) ) ); - register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category', 'default' ) ) ); - foreach ( $new_core_block_patterns as $core_block_pattern ) { register_block_pattern( 'core/' . $core_block_pattern,