Skip to content
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

Add fallback handling for plugins or themes using the Customizer #35877

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

@Clorith
Copy link
Member

@Clorith Clorith commented Oct 22, 2021

Description

This change introduces a new function, gutenberg_site_requires_customizer(), which looks up if any plugins, or theme features, have added support for the Customizer.

It then utilizes that check before letting Full Site Editing filter away the Customizer access points. It is worth noting that the Customizer is not deactivated even without this patch, but it is important to maintain a canonical entry-point for the user when any plugin, or theme feature, relies on it.

This would fix #35874

How has this been tested?

  1. Activate the Twenty Twenty One theme
  2. Install the WooCommerce plugin (no setup required, it just needs to be active)
  3. You should now see the Appearance > Customizer menu items
  4. Switch to the TT1-Blocks theme
  5. The Customizer menu is now missing, but a custom "Customize WooCommerce" link is added instead (this is WooCommerce working around the flaw as described in #35874)
  6. Apply this patch
  7. The Appearance > Customizer link should now have returned
  8. De-activate WooCommerce
  9. The Appearance > Customizer link should disapear as no more plugins or theme features rely on it.

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
@github-actions
Copy link

@github-actions github-actions bot commented Oct 22, 2021

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Clorith! 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.

@carolinan
Copy link
Contributor

@carolinan carolinan commented Oct 22, 2021

I am still curious why the removal of the menu item simply can't be reverted.

@Clorith
Copy link
Member Author

@Clorith Clorith commented Oct 22, 2021

Adding a quick note that my patch here implements a new function, gutenberg_site_requires_customizer(), although we could just as easily just add in an if statement for has_action() into the two locations that rely on it, this was done in case it needed to be more flexible (for example if strange edge cases needed to be accounted for as well, making it easier to add them in one location right away).

As for the discussion about whether something should be reverted or not, I'll leave that for the product team to tackle, my main concern with this PR was to ensure backwards compatibility and nothing more :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants