From 97caf6d814661173f62e273e499c00d2ef2f4979 Mon Sep 17 00:00:00 2001 From: cahdeemer Date: Wed, 26 Jun 2024 16:43:36 -0400 Subject: [PATCH 1/6] hide a bunch of inner blocks from the inserter --- blocks/post-byline/block.json | 3 +++ blocks/post-content/block.json | 3 +++ blocks/post-excerpt/block.json | 3 +++ blocks/post-featured-image/block.json | 3 +++ blocks/post-read-more/block.json | 3 +++ blocks/post-title/block.json | 3 +++ blocks/section/block.json | 3 +++ blocks/signup-form-list/block.json | 3 +++ blocks/signup-form/block.json | 3 +++ 9 files changed, 27 insertions(+) diff --git a/blocks/post-byline/block.json b/blocks/post-byline/block.json index c8415f33..e9bc024b 100644 --- a/blocks/post-byline/block.json +++ b/blocks/post-byline/block.json @@ -12,6 +12,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "overrideByline": { diff --git a/blocks/post-content/block.json b/blocks/post-content/block.json index 30f7add2..2a4e16a6 100644 --- a/blocks/post-content/block.json +++ b/blocks/post-content/block.json @@ -12,6 +12,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "overrideContent": { diff --git a/blocks/post-excerpt/block.json b/blocks/post-excerpt/block.json index b492c7b8..ec86fb20 100644 --- a/blocks/post-excerpt/block.json +++ b/blocks/post-excerpt/block.json @@ -13,6 +13,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "overrideExcerpt": { diff --git a/blocks/post-featured-image/block.json b/blocks/post-featured-image/block.json index 80c153a9..28d72ed2 100644 --- a/blocks/post-featured-image/block.json +++ b/blocks/post-featured-image/block.json @@ -12,6 +12,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "overrideImage": { diff --git a/blocks/post-read-more/block.json b/blocks/post-read-more/block.json index 2d5a0cfb..f59d7e6c 100644 --- a/blocks/post-read-more/block.json +++ b/blocks/post-read-more/block.json @@ -12,6 +12,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "readMoreText": { diff --git a/blocks/post-title/block.json b/blocks/post-title/block.json index 4d0cef4b..7ae44464 100644 --- a/blocks/post-title/block.json +++ b/blocks/post-title/block.json @@ -12,6 +12,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "overrideTitle": { diff --git a/blocks/section/block.json b/blocks/section/block.json index ca98e6ea..c997bed6 100644 --- a/blocks/section/block.json +++ b/blocks/section/block.json @@ -13,6 +13,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "showNumbers": { diff --git a/blocks/signup-form-list/block.json b/blocks/signup-form-list/block.json index 25a19038..8413a570 100644 --- a/blocks/signup-form-list/block.json +++ b/blocks/signup-form-list/block.json @@ -9,6 +9,9 @@ "description": "Child block of Newsletter Signup Form to show a single list", "textdomain": "wp-newsletter-builder", "editorScript": "file:index.ts", + "supports": { + "inserter": false + }, "render": "file:render.php", "attributes": { "logo": { diff --git a/blocks/signup-form/block.json b/blocks/signup-form/block.json index def13247..ec53f658 100644 --- a/blocks/signup-form/block.json +++ b/blocks/signup-form/block.json @@ -13,6 +13,9 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php", "viewScript": [ "file:view.ts" From d7f495c4ae0097dc47ba24cf8a231c3ed6c61a17 Mon Sep 17 00:00:00 2001 From: cahdeemer Date: Wed, 26 Jun 2024 17:19:12 -0400 Subject: [PATCH 2/6] add filter that adds new block category for newsletter builder blocks --- src/class-wp-newsletter-builder.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/class-wp-newsletter-builder.php b/src/class-wp-newsletter-builder.php index 47090e3b..ec1c1aec 100644 --- a/src/class-wp-newsletter-builder.php +++ b/src/class-wp-newsletter-builder.php @@ -26,6 +26,7 @@ public function __construct() { add_filter( 'wp_newsletter_builder_html_url', [ $this, 'modify_html_url' ] ); add_filter( 'pre_get_posts', [ $this, 'modify_query' ] ); add_action( 'init', [ $this, 'check_for_fieldmanager' ] ); + add_filter( 'block_categories_all', [$this, 'add_newsletter_block_category'], 10, 2 ); } /** @@ -337,4 +338,19 @@ public function check_for_fieldmanager(): void { add_action( 'admin_notices', [ $this, 'fieldmanager_not_found_error' ] ); } } + + /** + * Adds a new Newsletter block category. + * + * @param array $block_categories Array of categories for block types. + */ + public function add_newsletter_block_category( $categories ) { + + $categories[] = array( + 'slug' => 'wp-newsletter-builder-newsletter', + 'title' => 'Newsletter', + ); + + return $categories; + } } From 895a1a50927daf5b2c2ca4335f841a01eb2274f6 Mon Sep 17 00:00:00 2001 From: cahdeemer Date: Wed, 26 Jun 2024 17:20:10 -0400 Subject: [PATCH 3/6] move a bunch of blocks to new category --- block-filters/latest-posts/index.tsx | 1 + blocks/email-settings/block.json | 2 +- blocks/footer/block.json | 2 +- blocks/header/block.json | 2 +- blocks/post/block.json | 2 +- blocks/two-up-post/block.json | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/block-filters/latest-posts/index.tsx b/block-filters/latest-posts/index.tsx index 5f7e00ab..37bc838f 100644 --- a/block-filters/latest-posts/index.tsx +++ b/block-filters/latest-posts/index.tsx @@ -25,6 +25,7 @@ function modifyLatestPostsSupports(settings, name) { default: 20, }, }), + category: 'wp-newsletter-builder-newsletter', supports: Object.assign(settings.supports, { align: [], anchor: false, diff --git a/blocks/email-settings/block.json b/blocks/email-settings/block.json index 7d6834f0..f2b15a19 100644 --- a/blocks/email-settings/block.json +++ b/blocks/email-settings/block.json @@ -4,7 +4,7 @@ "name": "wp-newsletter-builder/email-settings", "version": "0.1.0", "title": "Email Settings", - "category": "design", + "category": "wp-newsletter-builder-newsletter", "icon": "email", "description": "Block to set the email subject, preview text, and list.", "textdomain": "wp-newsletter-builder", diff --git a/blocks/footer/block.json b/blocks/footer/block.json index ae71afbb..38611937 100644 --- a/blocks/footer/block.json +++ b/blocks/footer/block.json @@ -4,7 +4,7 @@ "name": "wp-newsletter-builder/footer", "version": "0.1.0", "title": "Newsletter Footer", - "category": "design", + "category": "wp-newsletter-builder-newsletter", "icon": "align-wide", "description": "Outputs the company logo, social links, address, and footer links.", "textdomain": "wp-newsletter-builder", diff --git a/blocks/header/block.json b/blocks/header/block.json index 96bfc99d..d8f6ad96 100644 --- a/blocks/header/block.json +++ b/blocks/header/block.json @@ -4,7 +4,7 @@ "name": "wp-newsletter-builder/header", "version": "0.1.0", "title": "Newsletter Header", - "category": "design", + "category": "wp-newsletter-builder-newsletter", "icon": "format-image", "description": "Displays the header image for a newsletter", "textdomain": "wp-newsletter-builder", diff --git a/blocks/post/block.json b/blocks/post/block.json index 159d91dd..dbe9a211 100644 --- a/blocks/post/block.json +++ b/blocks/post/block.json @@ -4,7 +4,7 @@ "name": "wp-newsletter-builder/post", "version": "0.1.0", "title": "Newsletter Single Post", - "category": "design", + "category": "wp-newsletter-builder-newsletter", "icon": "admin-post", "description": "Displays a post", "textdomain": "wp-newsletter-builder", diff --git a/blocks/two-up-post/block.json b/blocks/two-up-post/block.json index f3b1a66a..ee87baf9 100644 --- a/blocks/two-up-post/block.json +++ b/blocks/two-up-post/block.json @@ -4,7 +4,7 @@ "name": "wp-newsletter-builder/two-up-post", "version": "0.1.0", "title": "Two Up Newsletter Post", - "category": "design", + "category": "wp-newsletter-builder-newsletter", "icon": "editor-table", "description": "Displays two posts, side by side", "textdomain": "wp-newsletter-builder", From cb0bb8f9a8e63127142bda4c59b0cdb049fa63a7 Mon Sep 17 00:00:00 2001 From: cahdeemer Date: Thu, 27 Jun 2024 09:48:08 -0400 Subject: [PATCH 4/6] remove email settings and post item from insert --- blocks/email-settings/block.json | 3 +++ blocks/post-item/block.json | 3 +++ 2 files changed, 6 insertions(+) diff --git a/blocks/email-settings/block.json b/blocks/email-settings/block.json index f2b15a19..b6ab4214 100644 --- a/blocks/email-settings/block.json +++ b/blocks/email-settings/block.json @@ -13,5 +13,8 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php" } \ No newline at end of file diff --git a/blocks/post-item/block.json b/blocks/post-item/block.json index b8e25c19..4b3d306a 100644 --- a/blocks/post-item/block.json +++ b/blocks/post-item/block.json @@ -13,5 +13,8 @@ "style": [ "file:style-index.css" ], + "supports": { + "inserter": false + }, "render": "file:render.php" } From fb4044c7460a2bb628294bca072554c984df161a Mon Sep 17 00:00:00 2001 From: cahdeemer Date: Thu, 27 Jun 2024 09:51:43 -0400 Subject: [PATCH 5/6] lint --- src/class-wp-newsletter-builder.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/class-wp-newsletter-builder.php b/src/class-wp-newsletter-builder.php index ec1c1aec..92b101f1 100644 --- a/src/class-wp-newsletter-builder.php +++ b/src/class-wp-newsletter-builder.php @@ -26,7 +26,7 @@ public function __construct() { add_filter( 'wp_newsletter_builder_html_url', [ $this, 'modify_html_url' ] ); add_filter( 'pre_get_posts', [ $this, 'modify_query' ] ); add_action( 'init', [ $this, 'check_for_fieldmanager' ] ); - add_filter( 'block_categories_all', [$this, 'add_newsletter_block_category'], 10, 2 ); + add_filter( 'block_categories_all', [ $this, 'add_newsletter_block_category' ], 10, 2 ); } /** @@ -342,14 +342,17 @@ public function check_for_fieldmanager(): void { /** * Adds a new Newsletter block category. * - * @param array $block_categories Array of categories for block types. + * @param array $categories Array of categories for block types. + * + * @return array */ - public function add_newsletter_block_category( $categories ) { + public function add_newsletter_block_category( $categories ): array { - $categories[] = array( - 'slug' => 'wp-newsletter-builder-newsletter', + $categories[] = [ + 'slug' => 'wp-newsletter-builder-newsletter', 'title' => 'Newsletter', - ); + 'icon' => 'email-alt', + ]; return $categories; } From 7fd1e0d2bf00e565eebcb69d987d711503b2d3ac Mon Sep 17 00:00:00 2001 From: cahdeemer Date: Thu, 27 Jun 2024 10:01:29 -0400 Subject: [PATCH 6/6] bump version --- README.md | 2 +- plugin.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ba5622b..193bc43f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Contributors: alleyinteractive Tags: alleyinteractive, wp-newsletter-builder -Stable tag: 0.3.32 +Stable tag: 0.3.33 Requires at least: 6.2 diff --git a/plugin.php b/plugin.php index b278a050..36732920 100644 --- a/plugin.php +++ b/plugin.php @@ -3,7 +3,7 @@ * Plugin Name: Newsletter Builder * Plugin URI: https://github.com/alleyinteractive/wp-newsletter-builder * Description: Interface to manage email newsletters - * Version: 0.3.32 + * Version: 0.3.33 * Author: Alley Interactive * Author URI: https://github.com/alleyinteractive/wp-newsletter-builder * Requires at least: 6.2