-
Notifications
You must be signed in to change notification settings - Fork 24
Experiments: Boilerplate to add future experiments to the project. Add initial experiment sample with no use case yet. #113
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
75511d7
to
b4a9587
Compare
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.
Thanks, Carlos, this is looking good! Since this is still a draft I didn't go too deep, but still left some early feedback
*/ | ||
public function __construct() { | ||
// Temporarily disabled - will be enabled when experiments feature is ready | ||
// add_action( 'admin_menu', array( $this, 'admin_menu' ), 20 ); |
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.
We should check whether $this->experiments is empty to avoid adding the menu if there are no experiments, except for testing purposes.
assets/src/js/README.md
Outdated
|
||
To add a new experiment: | ||
|
||
1. Create a new experiment class in `includes/admin/experiments/` |
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.
Is this a "good practices" recommendation or a requirement? What's the reason to create the experiments in this folder instead of creating them in the place they belong, and just registering?
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.
Ideally, this way it should be easier to find all experiments registered instead of having to dig into the entire codebase. Also, I'm trying to follow the PHP class based plugin structure, which may differ from how we did things in Gutenberg.
Is more a recommendation than a requirement, but this way all the admin interface will be automatically generated on PHP.
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 remove the readme to prevent external devs to create more experiments.
assets/src/js/_acf-experiments.ts
Outdated
* | ||
* @package Secure Custom Fields | ||
* @subpackage Admin | ||
* @since 6.4.2 |
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.
6.4.2 is out, shouldn't it be 6.5?
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.
I did this before the update 😅
assets/src/js/_acf-experiments.ts
Outdated
export {}; | ||
|
||
// Initialize the SCF namespace if it doesn't exist | ||
if (typeof window.SCF === 'undefined') { |
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.
Shouldn't we reuse the existing acf
namespace until we migrate it?
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.
Yep. You are right. Otherwise it will be difficult to differentiate which is inside of each object.
It would be helpful to extract all changes related to code formatting to another PR and land separately, as it makes the review process more complex. What is the reason GitHub reports so massive changes in the lock file? |
Sure, done in #115
It seems it was due to the update of wp-scripts and all its dependencies. I will take a look at it. |
2acfc24
to
609f95d
Compare
This reverts commit 2ec1925.
609f95d
to
8636385
Compare
This PRs sets a standard for creating experiments and checking if they are enabled in JavaScript.
As there are no experiments ready yet, I commented all the code that initializes them with a
// Temporarily disabled
comment.The PR was getting big, so it is better to land this first and work later on next experiments.
If you want to test this out, just uncomment the lines // Temporarily disabled in
admin-experiments.php
file and you will have something like this:Extra stuff:
@wordpress/prettier-config
.