-
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
Font Library: Add a way to disable it. #55275
Comments
Currently, if you define the constant define( 'FONT_LIBRARY_DISABLED', true ); then the Font Library UI and the PHP code are not loaded. Do you think that's enough @spacedmonkey ? |
cc. @swissspidy @TimothyBJacobs @costdev, as you've helped out previously with the Font Library work 🙇 |
We shouldn't really introduce new constants for this kind of stuff in WordPress. It's better to handle this with new capabilities and/or filters. |
Agreed we shouldn't be using a constant. I think it might make sense for this to be a theme support that can be removed. |
@mikachan Thanks for the ping! I agree that we should avoid a constant for this, and think we should consider this a theme support removal as @TimothyBJacobs said, via: PHP: theme.json: Or if it's more about the user than the feature itself, capabilities as @swissspidy suggests. |
Thanks all! This is really helpful.
We're discussing creating potential new capabilities in #55280, perhaps
I think the ability to manage fonts is probably more about the individual user, however I like the idea of a theme support too, as this gives an additional level of control, especially for theme builders. Would it be appropriate to create both the new capabilities as well as the theme support removal? |
Turning off the Font Library at a theme level, in my opinion, doesn't make 100% sense because the feature to install and remove fonts is independent of the active theme. Only one part of the feature (activating and de-activating fonts) is theme-dependent via Global Styles.
Roles and capabilities are tightly related to particular users. I think that the idea is to be able to turn off the feature entirely, system-wide, for all the users, so a new capability doesn't seem to be the best option to do that. I'm not saying we should not create a new user capability as we are discussing this issue, but turning off the feature system-wide seems a different requirement.
I think having a filter, as suggested by @swissspidy, seems to be the best way to turn off the feature globally. Having something similar to Example: To disable the block editor for all post types, extenders can use the following:
Following this prior art existing in core, could we disable the Font Library with something like the following line?
|
IMO a filter is the preferred approach. As @matiasbenedetto noted, a filter is available to disable the block editor. Following that approach keeps consistency while providing extenders and site owners a mechanism to turn it off. What about capabilities? What about a constant? |
Thinking more about this ... A constant defined in a site's When does font processing start? If it's before must-use and/or plugins load, then a constant may be needed. |
Should the flag to disable the Font Library should disable only the UI to use it from the editor or it should disable the PHP and API rest functionality too? |
Constants are generally used because it makes it pretty easy to set things when (auto)installing WordPress. These are generally for bigger parts of WP that would affect how it works to a large extend. For example post revisions can be disabled with a constant (because on some hosting accounts they may overwhelm the DB?). On the other hand, seems disabling the Font Library is not one of these more critical parts, so I agree a constant is probably not needed.
+1. A filter should work there. Also a lot easier to test than a constant :)
Thinking that it should disable only the UI. This would solve several problems:
|
What?
Add a way to disable the Font Library.
When disabled:
Why?
To allow environments to disable the font library functionality.
Props to @spacedmonkey, who proposed this functionality.
The text was updated successfully, but these errors were encountered: