Improvement: Introducing new filter using which theme authors can modify whether the current theme supports FSE or not.#35616
Conversation
…ify whether the current theme supports FSE or not.
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @premanshup! 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. |
|
Howdy! What is the filter for? The function allows a theme or plugin to know if it is FSE enabled or not. Filtering this can lead to false negatives or false positives. |
@draganescu I was thinking of this filter from the legacy ( non-FSE ) themes perspective, what if they could implement both HTML and PHP file/folder structure? I'm thinking of a scenario where a theme could provide an option for users to switch from legacy theme to FSE theme or vice-versa. From my finding, I think this is the main function ( https://github.com/WordPress/gutenberg/blob/trunk/lib/full-site-editing/full-site-editing.php#L14 I was wondering if we can implement this filter so that legacy themes could be converted to FSE themes if needed or required by the users. I think the folder/file structure for FSE and legacy themes is different. One uses |
|
@draganescu Howdy! In addition to this, I have not yet checked how theme.json can be handled in both cases. I think there will be a need to handle the loading of the theme.json file. I will check in detail and see if that can be loaded conditionally as well? |
…gutenberg-is-fse-theme-filter
…emanshup/gutenberg into gutenberg-is-fse-theme-filter
oandregal
left a comment
There was a problem hiding this comment.
Hey Premanshu, I don't think adding a filter to change whether the theme.json exists is a good idea: either it does or doesn't. If you can share your specific needs, someone can probably help to identify how that can be done, what needs to be adapted if anything, etc.
|
Hello @oandregal ! Thank you so much for your feedback. I have mentioned my concern here in the issue. Please let me know if we can implement the filter for theme.json based on the two points I have shared in the issue. |
|
These methods are now part of WP core. Any related documentation should be improved, which probably has been fixed during code sync. I'm going to close the PR. Thanks for contributing, @premanshup! |
Description
This PR introduces a new filter
gutenberg_is_fse_themeinside functiongutenberg_is_fse_themeusing which theme developers can filter whether the theme supports FSE or not.Update FSE support -
How has this been tested?
Tested by adding the above filters and checking if they update the output for the function
gutenberg_is_fse_themeor not. The function's value is updated, so the filter seems to be working as expected.Screenshots
Types of changes
Improvement (non-breaking change which adds functionality).
Checklist:
*.native.jsfiles for terms that need renaming or removal).