Skip to content

Use the theme.json classes defined by the plugin in the REST controller - #38663

Merged
oandregal merged 1 commit into
trunkfrom
update/should-use-class-from-plugin
Feb 9, 2022
Merged

oandregal merged 1 commit into
trunkfrom
update/should-use-class-from-plugin

Conversation

@oandregal

Copy link
Copy Markdown
Member

This PR updates the REST controller to use the classes defined by the plugin instead of using the ones defined by WordPress.

The plugin supports WordPress 5.8 and WordPress 5.9. Both versions have the theme.json classes but use different implementations. Using the classes defined by WordPress is problematic because the endpoint defined by the plugin will behave differently depending on the WordPress version, so we should use the ones defined by the plugin.

Some examples of things that are different that could affect this endpoint: the LATEST_SCHEMA changes from 1 to 2, the constructor does more things in 5.9 (such as checking whether we should remove theme colors that are already defined by core or opt-in into a few defaults), the resolver looks up for child themes in 5.9.

@oandregal oandregal changed the title The plugin code sohuld use the theme.json classes defined by the plugin Use the theme.json classes defined by the plugin in the REST controller Feb 9, 2022
@oandregal oandregal self-assigned this Feb 9, 2022
@oandregal oandregal added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Feb 9, 2022

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. We did something similar in #36898.

@oandregal
oandregal merged commit 93de664 into trunk Feb 9, 2022
@oandregal
oandregal deleted the update/should-use-class-from-plugin branch February 9, 2022 13:09
@github-actions github-actions Bot added this to the Gutenberg 12.6 milestone Feb 9, 2022
@bph bph added the Needs Dev Note Requires a developer note for a major WordPress release cycle label Mar 24, 2022
@bph bph mentioned this pull request Apr 5, 2022
37 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Dev Note Requires a developer note for a major WordPress release cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants