Skip to content

Commit

Permalink
Merge pull request #161 from alleyinteractive/feature/LEDE-2677/block…
Browse files Browse the repository at this point in the history
…-organization

LEDE-2677 Organize Newsletter Builder Blocks
  • Loading branch information
cahdeemer authored Jun 27, 2024
2 parents 916d98b + 7fd1e0d commit 1e41c24
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions block-filters/latest-posts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function modifyLatestPostsSupports(settings, name) {
default: 20,
},
}),
category: 'wp-newsletter-builder-newsletter',
supports: Object.assign(settings.supports, {
align: [],
anchor: false,
Expand Down
5 changes: 4 additions & 1 deletion blocks/email-settings/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -13,5 +13,8 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php"
}
2 changes: 1 addition & 1 deletion blocks/footer/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion blocks/header/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions blocks/post-byline/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"attributes": {
"overrideByline": {
Expand Down
3 changes: 3 additions & 0 deletions blocks/post-content/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"attributes": {
"overrideContent": {
Expand Down
3 changes: 3 additions & 0 deletions blocks/post-excerpt/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"attributes": {
"overrideExcerpt": {
Expand Down
3 changes: 3 additions & 0 deletions blocks/post-featured-image/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"attributes": {
"overrideImage": {
Expand Down
3 changes: 3 additions & 0 deletions blocks/post-item/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php"
}
3 changes: 3 additions & 0 deletions blocks/post-read-more/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"attributes": {
"readMoreText": {
Expand Down
3 changes: 3 additions & 0 deletions blocks/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"attributes": {
"overrideTitle": {
Expand Down
2 changes: 1 addition & 1 deletion blocks/post/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions blocks/section/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"attributes": {
"showNumbers": {
Expand Down
3 changes: 3 additions & 0 deletions blocks/signup-form-list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 3 additions & 0 deletions blocks/signup-form/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"style": [
"file:style-index.css"
],
"supports": {
"inserter": false
},
"render": "file:render.php",
"viewScript": [
"file:view.ts"
Expand Down
2 changes: 1 addition & 1 deletion blocks/two-up-post/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/class-wp-newsletter-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/**
Expand Down Expand Up @@ -337,4 +338,22 @@ public function check_for_fieldmanager(): void {
add_action( 'admin_notices', [ $this, 'fieldmanager_not_found_error' ] );
}
}

/**
* Adds a new Newsletter block category.
*
* @param array $categories Array of categories for block types.
*
* @return array
*/
public function add_newsletter_block_category( $categories ): array {

$categories[] = [
'slug' => 'wp-newsletter-builder-newsletter',
'title' => 'Newsletter',
'icon' => 'email-alt',
];

return $categories;
}
}

0 comments on commit 1e41c24

Please sign in to comment.