Skip to content

Add plugins styles customization support#37208

Closed
Lucisu wants to merge 10 commits into
WordPress:trunkfrom
Lucisu:add/plugins-styles-support
Closed

Add plugins styles customization support#37208
Lucisu wants to merge 10 commits into
WordPress:trunkfrom
Lucisu:add/plugins-styles-support

Conversation

@Lucisu

@Lucisu Lucisu commented Dec 7, 2021

Copy link
Copy Markdown
Contributor

Description

This pull request adds three filters that allow plugins to customize Global Styles and theme.json files.

It solves #37206

How has this been tested?

Just added filters, so my tests were just loading everything, pretty straightforward.

Types of changes

New feature

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

gutenbergplugin and others added 10 commits November 17, 2021 19:12
…ustom_post_type() (WordPress#36584)

* Add caching to WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type

Refactor
`WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type`
to add caching to the `wp_global_styles` post type lookup, and also to
remove the duplicate code added in
`gutenberg_add_active_global_styles_link`.

Fixes WordPress#36574

* Add unit tests

* Use the correct query filter

* Use wp_cache_set instead of wp_cache_add.

* Remove the filter when finished.

* Simplify the if blocks
* Let's check if the scrollContainer can be found before trying to use its property `scrollTop`.

* Moving default top position to a const and moving the comment.
@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Dec 7, 2021
@github-actions

github-actions Bot commented Dec 7, 2021

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Lucisu! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@Lucisu

Lucisu commented Dec 7, 2021

Copy link
Copy Markdown
Contributor Author

I just noticed I added the commit to the 12.0.2, I'll try to fix it later

@aristath

aristath commented Dec 8, 2021

Copy link
Copy Markdown
Member

Hey there @Lucisu, thank you for this PR!
I'm not sure what this is trying to accomplish though. It looks like you're trying to allow changing the path of the theme.json file? If so, for what purpose?
We can already load alternative data by using the WP_Query filters when the parser tries to get the user-data 🤔

@skorasaurus skorasaurus added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] Needs More Info Follow-up required in order to be actionable. labels Sep 27, 2022
@Lucisu

Lucisu commented Oct 3, 2022

Copy link
Copy Markdown
Contributor Author

Hello, @skorasaurus! I'm sorry for the delay.

So, I remember that when I sent this pull request, I was developing a custom plugin that would inject some content out of the user data in the theme.json in runtime.

I didn't find any filters to accomplish this, so I had to create a workaround, and not very beautiful.

Please, let me know if it makes sense.

Thank you!

@Mamaduka

Mamaduka commented Oct 3, 2022

Copy link
Copy Markdown
Member

Hi, @Lucisu

The #44015 introduced a few hooks that might serve the same purpose.

Handbook: https://developer.wordpress.org/block-editor/reference-guides/filters/global-styles-filters/.

Let me know if we can close this PR.

Thanks,

George

@Lucisu

Lucisu commented Oct 3, 2022

Copy link
Copy Markdown
Contributor Author

Hey there! Yep, that will solve the problem!

Thanks ;)

@Mamaduka Mamaduka closed this Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] Needs More Info Follow-up required in order to be actionable.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants