-
Notifications
You must be signed in to change notification settings - Fork 58
feat(content-gate): create layout and improve asset management #4399
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
base: trunk
Are you sure you want to change the base?
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 refactors the content gate system to support mode-specific layout posts (for registration and custom access modes) and improves the organization of block editor assets. The changes move block editor asset enqueueing to appropriate locations (trait and dedicated classes) for better separation of concerns.
Changes:
- Added ability to create and manage separate layout posts for each gate mode (registration and custom access)
- Refactored asset enqueueing to move layout-related assets to the trait and mode-specific assets to dedicated classes
- Added "Edit Layout" action buttons in the content gates UI to navigate to mode-specific layout editors
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.js | Added entry points for memberships and metering-settings editor modules |
| src/wizards/types/window.d.ts | Added edit_gate_layout_url to window type definition |
| src/wizards/audience/views/content-gates/utils.tsx | New utility function to build edit gate layout URLs |
| src/wizards/audience/views/content-gates/registration.tsx | Added gateId prop and "Edit Layout" button for registration mode |
| src/wizards/audience/views/content-gates/custom-access.tsx | Added gateId prop and "Edit Layout" button for custom access mode |
| src/wizards/audience/views/content-gates/content-gate-settings.tsx | Passed gate ID to Registration and CustomAccess components |
| src/content-gate/editor/metering-settings.js | Converted to self-registering plugin with PluginDocumentSettingPanel |
| src/content-gate/editor/memberships.js | New standalone module for memberships gate editor functionality |
| src/content-gate/editor/editor.js | Removed memberships and metering code (now separate modules) |
| includes/wizards/audience/class-audience-content-gates.php | Added edit_gate_layout_url to localized script data |
| includes/plugins/wc-memberships/class-memberships.php | Updated to enqueue new memberships module with proper priority |
| includes/content-gate/trait-content-gate-layout.php | Added enqueue_block_editor_layout_assets method to trait |
| includes/content-gate/class-metering.php | Added enqueue_block_editor_assets method for metering panel |
| includes/content-gate/class-content-gate.php | Added get_edit_gate_layout_url and handle_edit_gate_layout methods, removed enqueue_block_editor_assets |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
All Submissions:
Changes proposed in this Pull Request:
This PR implements a few things:
How to test the changes in this Pull Request:
Other information: