-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor duotone class to allow instancing #49932
Conversation
664558e
to
c5df7ae
Compare
6111f89
to
f6a59ec
Compare
f6a59ec
to
6bd5cc9
Compare
Flaky tests detected in f6a59ec1104bc890476a239673f0bfab483eddb1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4748009529
|
c5df7ae
to
498a2b0
Compare
The public functions are tied directly to the hooks that need to be called over the course of a single page render, so instancing doesn't really make sense. If we ever need instancing for another reason, we can make a new class with instancing. |
What?
Part 5 in a set of duotone php refactoring to fix small issues in duotone rendering.
This part changes the architecture of the duotone class to allow for instancing.
Why?
This allows for more flexibility in the future if we may need multiple instances of the duotone rendering state.
This should also make things a little easier to test since we can just create a new instance rather than resetting the static properties between tests.
How?
private static
properties to be instance properties$wp_duotone_support
global much like is done forWP_Styles
andWP_Scripts
.The first commit shows what it would look like as a singleton instead. I feel like I slightly prefer the global version, but if there's a compelling argument to use a singleton instead I can easily switch back.
Testing Instructions
Example content for TT3 block-out, canary, and pilgrimage variations