Skip to content

Conversation

@miguelpeixe
Copy link
Member

@miguelpeixe miguelpeixe commented Jan 15, 2026

All Submissions:

Changes proposed in this Pull Request:

This PR implements a few things:

  • Allow the creation of gate layout posts for each gate mode (registration and custom access)
  • Move the layout block editor asset enqueueing strategy to the trait
  • Isolate the Memberships block editor asset so its own class enqueues it
  • Isolate the Metering block editor asset so its own class also enqueues it

How to test the changes in this Pull Request:

  1. Make sure you have Woo Memberships enabled and multiple plans configured
  2. Edit the Memberships gate (Audience -> Configuration -> Content Gate)
  3. Confirm every panel continues to work as expected
    1. Edit gates for differents plan and save
    2. Customize layout settings
    3. Customize metering settings
  4. Create/edit a regular content gate (Audience -> Content Gates)
  5. Enable both Registration and Paid access
  6. Click "Edit layout" for each mode
  7. Confirm each creates a draft with layout panels
  8. Edit both layouts and confirm the values persist
  9. Back in the "Content Gates" page, confirm that clicking "Edit layout" redirects to the created posts (and not new ones)

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@miguelpeixe miguelpeixe self-assigned this Jan 15, 2026
@miguelpeixe miguelpeixe requested a review from a team as a code owner January 15, 2026 17:29
@miguelpeixe miguelpeixe added the [Status] Needs Review The issue or pull request needs to be reviewed label Jan 15, 2026
@miguelpeixe miguelpeixe requested a review from Copilot January 15, 2026 17:55
Copy link

Copilot AI left a 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.

miguelpeixe and others added 3 commits January 15, 2026 15:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The issue or pull request needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants