-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/announcements be #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive Announcements feature to the plugin, enabling administrators to create, manage, and display announcements across the website with flexible placement and visibility rules.
- Added announcement post type with meta fields for content, styling, scheduling, and display rules
- Implemented a rule-based system for controlling where and when announcements are displayed
- Created block components for rendering announcements in theme templates
Reviewed Changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| wp-content/themes/core/parts/header.html | Added announcement renderer blocks above and below header |
| wp-content/themes/core/blocks/tribe/announcements/block.json | Formatting cleanup for alignment options |
| wp-content/themes/core/blocks/tribe/announcement-renderer/* | New block for rendering announcements with editor integration |
| wp-content/plugins/core/src/Post_Types/Announcement/* | Announcement post type configuration and class definitions |
| wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php | Comprehensive meta fields for announcement configuration |
| wp-content/plugins/core/src/Object_Meta/Meta_Definer.php | Registration of announcement meta in DI container |
| wp-content/plugins/core/src/Core.php | Added announcement subscriber to core post types |
| wp-content/plugins/core/src/Components/Announcements/* | Rule system and rendering logic for announcements |
| wp-content/plugins/core/src/Blocks/Blocks_Definer.php | Registration of announcement-renderer block type |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
wp-content/themes/core/blocks/tribe/announcement-renderer/block.json
Outdated
Show resolved
Hide resolved
wp-content/themes/core/blocks/tribe/announcement-renderer/block.json
Outdated
Show resolved
Hide resolved
wp-content/themes/core/blocks/tribe/announcement-renderer/edit.js
Outdated
Show resolved
Hide resolved
wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php
Outdated
Show resolved
Hide resolved
wp-content/plugins/core/src/Components/Announcements/Rules/Page_Visibility_Rule.php
Outdated
Show resolved
Hide resolved
wp-content/plugins/core/src/Components/Announcements/Rules/Front_Page_Rule.php
Outdated
Show resolved
Hide resolved
…k.json Co-authored-by: Copilot <[email protected]>
…k.json Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
wp-content/plugins/core/src/Components/Announcements/Rules/Scheduling_Rule.php
Outdated
Show resolved
Hide resolved
wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php
Outdated
Show resolved
Hide resolved
wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php
Outdated
Show resolved
Hide resolved
wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php
Outdated
Show resolved
Hide resolved
wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php
Outdated
Show resolved
Hide resolved
…eduling_Rule.php Co-authored-by: Copilot <[email protected]>
…se into feature/announcements-be
GeoffDusome
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dotjon Can you explain the creation / usage of the additional announcement-renderer block? I see that you're rendering the announcements block inside of the new one but I was just wondering if we could cut out the middle and just use the announcements block as the renderer?
Sure @GeoffDusome; my initial approach used the announcement block directly but it added a lot of complexity to it. With the 2 block approach it keeps things singly responsible and means we can manually use the Announcement block without conflicting attributes vs CPT logic; the announcement block stays simple and can be used anywhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking & working great from my testing. I made a few FE updates:
- Connected the Announcements block to the attributes
- Removed style files from the Announcement Renderer block, as they aren't required for now. I'm fine with the Renderer showing in the editor, even if the block is empty, as we need to be able to remove the block if we want a simple way to stop supporting announcements without removing the feature entirely (say, if a client wants it later but not now).
Just need to get the editable attributes onto the Announcements block itself so that the block can be used separately.
Thank you and great work here! 🌮
wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
@dotjon I'm realizing now I gave you an impossible task here and that I should have handled the controls for the block. That's my fault. For some reason I thought this was an ACF block. I'm going to work on finalizing what you started here and we'll get this buttoned up for merging! |
GeoffDusome
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 This is looking great now.
Can you just give a double check of the BE updates I had to make in my most recent commit and then I'd like to get a quick view from @JMRhodes before we merge. Thank you!
| $query = new \WP_Query( [ | ||
| 'post_type' => Announcement::NAME, | ||
| 'post_status' => 'publish', | ||
| 'posts_per_page' => -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's set a manageable upper limit here, just as a safe practice.
JMRhodes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 just one small adjustment, otherwise looks good 👍
…se into feature/announcements-be
This pull request introduces a new Announcements feature to the plugin, including announcement post type support, block rendering, and a flexible rule-based system for displaying announcements. The changes add core classes for managing, rendering, and determining the visibility of announcements, as well as registering the necessary block types and meta definitions.
Announcements Feature Implementation
Announcement_Controllerto manage fetching and filtering announcements based on a set of rules (placement, front page, page visibility, scheduling).Placement_Rule,Front_Page_Rule,Page_Visibility_Rule, andScheduling_Rule, all implementing a sharedRule_Interface. [1] [2] [3] [4] [5]Rendering and Block Registration
Announcement_Rendererto render announcements as block markup and HTML, supporting placement and context-based rendering.tribe/announcement-rendererin the block definer.Meta and Post Type Integration
Announcement_Metain the meta definer for object meta support. [1] [2]Announcement_Subscriberto the core post type subscribers for proper initialization.