Skip to content

Add hooks to filter theme.json data#3247

Closed
oandregal wants to merge 6 commits intoWordPress:trunkfrom
oandregal:add/hooks-for-theme-json
Closed

Add hooks to filter theme.json data#3247
oandregal wants to merge 6 commits intoWordPress:trunkfrom
oandregal:add/hooks-for-theme-json

Conversation

@oandregal
Copy link
Copy Markdown
Member

@oandregal oandregal commented Sep 14, 2022

Trac ticket: https://core.trac.wordpress.org/ticket/56467

Backports WordPress/gutenberg#44015 WordPress/gutenberg#44109 WordPress/gutenberg#44159

This PR ports the work done in Gutenberg (to be released in 14.1) to add hooks to filter the theme.json data. Specifically, it adds the following filters: theme_json_default, theme_json_blocks, theme_json_theme``theme_json_user.

@michalczaplinski
Copy link
Copy Markdown
Contributor

I think this looks good to me, but would be good to have someone else from core to take a look as well 🙂

@oandregal
Copy link
Copy Markdown
Member Author

perhaps @jorgefilipecosta or @gziolo can help?

@oandregal
Copy link
Copy Markdown
Member Author

Related PR #3261

pento pushed a commit that referenced this pull request Sep 15, 2022
This consolidates the name of a filter introduced earlier in the 6.1 cycle, renaming it from `get_style_nodes` to `theme_json_get_style_nodes` as to be more coherent with the other hooks introduced in 6.1 as well.

This commit backports the original PR from Gutenberg repository:
* [WordPress/gutenberg#44189 #44189 Use prefix 'theme_json_' in hooks related to theme.json]

Reference: [#3247 #3247 Add hooks to filter theme.json data].

Follow-up to [54118].

Props oandregal, scruffian, bernhard-reiter.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54183 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Sep 15, 2022
This consolidates the name of a filter introduced earlier in the 6.1 cycle, renaming it from `get_style_nodes` to `theme_json_get_style_nodes` as to be more coherent with the other hooks introduced in 6.1 as well.

This commit backports the original PR from Gutenberg repository:
* [WordPress/gutenberg#44189 #44189 Use prefix 'theme_json_' in hooks related to theme.json]

Reference: [WordPress/wordpress-develop#3247 #3247 Add hooks to filter theme.json data].

Follow-up to [54118].

Props oandregal, scruffian, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54183


git-svn-id: http://core.svn.wordpress.org/trunk@53742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to gilzow/wordpress-performance that referenced this pull request Sep 15, 2022
This consolidates the name of a filter introduced earlier in the 6.1 cycle, renaming it from `get_style_nodes` to `theme_json_get_style_nodes` as to be more coherent with the other hooks introduced in 6.1 as well.

This commit backports the original PR from Gutenberg repository:
* [WordPress/gutenberg#44189 #44189 Use prefix 'theme_json_' in hooks related to theme.json]

Reference: [WordPress/wordpress-develop#3247 #3247 Add hooks to filter theme.json data].

Follow-up to [54118].

Props oandregal, scruffian, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54183


git-svn-id: https://core.svn.wordpress.org/trunk@53742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Copy link
Copy Markdown
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

I left some minor notes about the PHPDoc comments.

As a follow-up, we should cover new filters with unit tests to ensure they work correctly and don't regress over time.

@oandregal
Copy link
Copy Markdown
Member Author

@gziolo addressed your feedback.

whereiscodedude pushed a commit to whereiscodedude/wpss that referenced this pull request Sep 18, 2022
This consolidates the name of a filter introduced earlier in the 6.1 cycle, renaming it from `get_style_nodes` to `theme_json_get_style_nodes` as to be more coherent with the other hooks introduced in 6.1 as well.

This commit backports the original PR from Gutenberg repository:
* [WordPress/gutenberg#44189 #44189 Use prefix 'theme_json_' in hooks related to theme.json]

Reference: [WordPress/wordpress-develop#3247 #3247 Add hooks to filter theme.json data].

Follow-up to [54118].

Props oandregal, scruffian, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54183
Copy link
Copy Markdown
Contributor

@ockham ockham left a comment

Choose a reason for hiding this comment

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

Thank you @oandregal! This LGTM :shipit:

Would you mind filing a PR to address @gziolo's suggestion?

As a follow-up, we should cover new filters with unit tests to ensure they work correctly and don't regress over time.

@audrasjb audrasjb self-assigned this Sep 20, 2022
@audrasjb
Copy link
Copy Markdown
Contributor

@audrasjb audrasjb closed this Sep 20, 2022
Copy link
Copy Markdown
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@oandregal oandregal deleted the add/hooks-for-theme-json branch September 20, 2022 18:36
ootwch pushed a commit to ootwch/wordpress-develop that referenced this pull request Nov 4, 2022
This consolidates the name of a filter introduced earlier in the 6.1 cycle, renaming it from `get_style_nodes` to `theme_json_get_style_nodes` as to be more coherent with the other hooks introduced in 6.1 as well.

This commit backports the original PR from Gutenberg repository:
* [WordPress/gutenberg#44189 #44189 Use prefix 'theme_json_' in hooks related to theme.json]

Reference: [WordPress#3247 WordPress#3247 Add hooks to filter theme.json data].

Follow-up to [54118].

Props oandregal, scruffian, bernhard-reiter.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54183 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

6 participants