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 disable FSE theme support flag #30760

Closed
wants to merge 3 commits into from
Closed

Conversation

MaggieCabrera
Copy link
Contributor

Description

Made FSE optional via a theme support flag so that block-based themes can be used in a classic environment.

How has this been tested?

Added the add_theme_support( 'disable-fse' ); flag to a block based theme (such as Empty Theme)

Screenshots

Screenshot 2021-04-12 at 18 10 22

Types of changes

New feature (non-breaking change which adds functionality)

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).

@MaggieCabrera MaggieCabrera added [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Feature] Full Site Editing labels Apr 12, 2021
@MaggieCabrera MaggieCabrera self-assigned this Apr 12, 2021
@youknowriad
Copy link
Contributor

Thanks for the PR. That said, this needs a bit more context, why do we want to do that, what do we want to disable exactly here since FSE also means block based themes? Also, we've been moving away from theme support flags, if we want to introduce config, theme.json is probably the best way.

@github-actions
Copy link

github-actions bot commented Apr 12, 2021

Size Change: -776 B (0%)

Total Size: 1.47 MB

Filename Size Change
build/block-editor/index.js 131 kB +1.23 kB (+1%)
build/block-editor/style-rtl.css 13 kB +449 B (+4%)
build/block-editor/style.css 13 kB +445 B (+4%)
build/block-library/blocks/query/editor-rtl.css 131 B -679 B (-84%) 🏆
build/block-library/blocks/query/editor.css 132 B -677 B (-84%) 🏆
build/block-library/editor-rtl.css 9.47 kB -359 B (-4%)
build/block-library/editor.css 9.46 kB -361 B (-4%)
build/block-library/index.js 153 kB -932 B (-1%)
build/components/index.js 285 kB +20 B (0%)
build/compose/index.js 11.6 kB -1 B (0%)
build/core-data/index.js 17 kB +1 B (0%)
build/customize-widgets/index.js 8.27 kB +22 B (0%)
build/customize-widgets/style-rtl.css 666 B +36 B (+6%) 🔍
build/customize-widgets/style.css 667 B +36 B (+6%) 🔍
build/data-controls/index.js 836 B -1 B (0%)
build/date/index.js 31.9 kB -3 B (0%)
build/dom-ready/index.js 576 B -1 B (0%)
build/dom/index.js 5.12 kB +1 B (0%)
build/edit-navigation/index.js 17.1 kB -1 B (0%)
build/edit-post/index.js 339 kB -1 B (0%)
build/editor/index.js 42.6 kB +2 B (0%)
build/element/index.js 4.62 kB -1 B (0%)
build/format-library/index.js 6.77 kB +1 B (0%)
build/keyboard-shortcuts/index.js 2.53 kB +1 B (0%)
build/keycodes/index.js 1.95 kB +1 B (0%)
build/media-utils/index.js 5.39 kB -1 B (0%)
build/notices/index.js 1.85 kB +1 B (0%)
build/primitives/index.js 1.42 kB +1 B (0%)
build/react-i18n/index.js 1.45 kB -1 B (0%)
build/redux-routine/index.js 2.84 kB +2 B (0%)
build/server-side-render/index.js 2.6 kB -1 B (0%)
build/shortcode/index.js 1.7 kB +1 B (0%)
build/warning/index.js 1.14 kB -1 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.78 kB 0 B
build/api-fetch/index.js 3.41 kB 0 B
build/autop/index.js 2.83 kB 0 B
build/blob/index.js 664 B 0 B
build/block-directory/index.js 8.62 kB 0 B
build/block-directory/style-rtl.css 1 kB 0 B
build/block-directory/style.css 1.01 kB 0 B
build/block-library/blocks/archives/editor-rtl.css 61 B 0 B
build/block-library/blocks/archives/editor.css 60 B 0 B
build/block-library/blocks/audio/editor-rtl.css 58 B 0 B
build/block-library/blocks/audio/editor.css 58 B 0 B
build/block-library/blocks/audio/style-rtl.css 112 B 0 B
build/block-library/blocks/audio/style.css 112 B 0 B
build/block-library/blocks/block/editor-rtl.css 161 B 0 B
build/block-library/blocks/block/editor.css 161 B 0 B
build/block-library/blocks/button/editor-rtl.css 475 B 0 B
build/block-library/blocks/button/editor.css 474 B 0 B
build/block-library/blocks/button/style-rtl.css 503 B 0 B
build/block-library/blocks/button/style.css 503 B 0 B
build/block-library/blocks/buttons/editor-rtl.css 315 B 0 B
build/block-library/blocks/buttons/editor.css 315 B 0 B
build/block-library/blocks/buttons/style-rtl.css 368 B 0 B
build/block-library/blocks/buttons/style.css 368 B 0 B
build/block-library/blocks/calendar/style-rtl.css 208 B 0 B
build/block-library/blocks/calendar/style.css 208 B 0 B
build/block-library/blocks/categories/editor-rtl.css 84 B 0 B
build/block-library/blocks/categories/editor.css 83 B 0 B
build/block-library/blocks/categories/style-rtl.css 79 B 0 B
build/block-library/blocks/categories/style.css 79 B 0 B
build/block-library/blocks/code/style-rtl.css 90 B 0 B
build/block-library/blocks/code/style.css 90 B 0 B
build/block-library/blocks/columns/editor-rtl.css 190 B 0 B
build/block-library/blocks/columns/editor.css 190 B 0 B
build/block-library/blocks/columns/style-rtl.css 436 B 0 B
build/block-library/blocks/columns/style.css 435 B 0 B
build/block-library/blocks/cover/editor-rtl.css 605 B 0 B
build/block-library/blocks/cover/editor.css 605 B 0 B
build/block-library/blocks/cover/style-rtl.css 1.23 kB 0 B
build/block-library/blocks/cover/style.css 1.23 kB 0 B
build/block-library/blocks/embed/editor-rtl.css 486 B 0 B
build/block-library/blocks/embed/editor.css 486 B 0 B
build/block-library/blocks/embed/style-rtl.css 401 B 0 B
build/block-library/blocks/embed/style.css 400 B 0 B
build/block-library/blocks/file/editor-rtl.css 301 B 0 B
build/block-library/blocks/file/editor.css 300 B 0 B
build/block-library/blocks/file/frontend.js 765 B 0 B
build/block-library/blocks/file/style-rtl.css 255 B 0 B
build/block-library/blocks/file/style.css 255 B 0 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB 0 B
build/block-library/blocks/freeform/editor.css 2.44 kB 0 B
build/block-library/blocks/gallery/editor-rtl.css 704 B 0 B
build/block-library/blocks/gallery/editor.css 705 B 0 B
build/block-library/blocks/gallery/style-rtl.css 1.09 kB 0 B
build/block-library/blocks/gallery/style.css 1.09 kB 0 B
build/block-library/blocks/group/editor-rtl.css 160 B 0 B
build/block-library/blocks/group/editor.css 160 B 0 B
build/block-library/blocks/group/style-rtl.css 57 B 0 B
build/block-library/blocks/group/style.css 57 B 0 B
build/block-library/blocks/heading/editor-rtl.css 129 B 0 B
build/block-library/blocks/heading/editor.css 129 B 0 B
build/block-library/blocks/heading/style-rtl.css 76 B 0 B
build/block-library/blocks/heading/style.css 76 B 0 B
build/block-library/blocks/html/editor-rtl.css 281 B 0 B
build/block-library/blocks/html/editor.css 281 B 0 B
build/block-library/blocks/image/editor-rtl.css 717 B 0 B
build/block-library/blocks/image/editor.css 716 B 0 B
build/block-library/blocks/image/style-rtl.css 476 B 0 B
build/block-library/blocks/image/style.css 478 B 0 B
build/block-library/blocks/latest-comments/style-rtl.css 281 B 0 B
build/block-library/blocks/latest-comments/style.css 282 B 0 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B 0 B
build/block-library/blocks/latest-posts/editor.css 137 B 0 B
build/block-library/blocks/latest-posts/style-rtl.css 523 B 0 B
build/block-library/blocks/latest-posts/style.css 522 B 0 B
build/block-library/blocks/legacy-widget/editor-rtl.css 398 B 0 B
build/block-library/blocks/legacy-widget/editor.css 399 B 0 B
build/block-library/blocks/list/style-rtl.css 63 B 0 B
build/block-library/blocks/list/style.css 63 B 0 B
build/block-library/blocks/media-text/editor-rtl.css 191 B 0 B
build/block-library/blocks/media-text/editor.css 191 B 0 B
build/block-library/blocks/media-text/style-rtl.css 535 B 0 B
build/block-library/blocks/media-text/style.css 532 B 0 B
build/block-library/blocks/more/editor-rtl.css 434 B 0 B
build/block-library/blocks/more/editor.css 434 B 0 B
build/block-library/blocks/navigation-link/editor-rtl.css 597 B 0 B
build/block-library/blocks/navigation-link/editor.css 597 B 0 B
build/block-library/blocks/navigation-link/style-rtl.css 1.07 kB 0 B
build/block-library/blocks/navigation-link/style.css 1.07 kB 0 B
build/block-library/blocks/navigation/editor-rtl.css 1.24 kB 0 B
build/block-library/blocks/navigation/editor.css 1.24 kB 0 B
build/block-library/blocks/navigation/style-rtl.css 272 B 0 B
build/block-library/blocks/navigation/style.css 271 B 0 B
build/block-library/blocks/nextpage/editor-rtl.css 395 B 0 B
build/block-library/blocks/nextpage/editor.css 395 B 0 B
build/block-library/blocks/page-list/editor-rtl.css 239 B 0 B
build/block-library/blocks/page-list/editor.css 240 B 0 B
build/block-library/blocks/page-list/style-rtl.css 167 B 0 B
build/block-library/blocks/page-list/style.css 167 B 0 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B 0 B
build/block-library/blocks/paragraph/editor.css 157 B 0 B
build/block-library/blocks/paragraph/style-rtl.css 247 B 0 B
build/block-library/blocks/paragraph/style.css 248 B 0 B
build/block-library/blocks/post-author/editor-rtl.css 209 B 0 B
build/block-library/blocks/post-author/editor.css 209 B 0 B
build/block-library/blocks/post-author/style-rtl.css 183 B 0 B
build/block-library/blocks/post-author/style.css 184 B 0 B
build/block-library/blocks/post-comments-form/style-rtl.css 250 B 0 B
build/block-library/blocks/post-comments-form/style.css 250 B 0 B
build/block-library/blocks/post-content/editor-rtl.css 139 B 0 B
build/block-library/blocks/post-content/editor.css 139 B 0 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B 0 B
build/block-library/blocks/post-excerpt/editor.css 73 B 0 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B 0 B
build/block-library/blocks/post-excerpt/style.css 69 B 0 B
build/block-library/blocks/post-featured-image/editor-rtl.css 338 B 0 B
build/block-library/blocks/post-featured-image/editor.css 338 B 0 B
build/block-library/blocks/post-featured-image/style-rtl.css 100 B 0 B
build/block-library/blocks/post-featured-image/style.css 100 B 0 B
build/block-library/blocks/post-title/style-rtl.css 60 B 0 B
build/block-library/blocks/post-title/style.css 60 B 0 B
build/block-library/blocks/preformatted/style-rtl.css 103 B 0 B
build/block-library/blocks/preformatted/style.css 103 B 0 B
build/block-library/blocks/pullquote/editor-rtl.css 183 B 0 B
build/block-library/blocks/pullquote/editor.css 183 B 0 B
build/block-library/blocks/pullquote/style-rtl.css 318 B 0 B
build/block-library/blocks/pullquote/style.css 318 B 0 B
build/block-library/blocks/query-loop/editor-rtl.css 83 B 0 B
build/block-library/blocks/query-loop/editor.css 82 B 0 B
build/block-library/blocks/query-loop/style-rtl.css 315 B 0 B
build/block-library/blocks/query-loop/style.css 317 B 0 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B 0 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B 0 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B 0 B
build/block-library/blocks/query-pagination/editor.css 262 B 0 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B 0 B
build/block-library/blocks/query-pagination/style.css 168 B 0 B
build/block-library/blocks/query-title/editor-rtl.css 86 B 0 B
build/block-library/blocks/query-title/editor.css 86 B 0 B
build/block-library/blocks/quote/style-rtl.css 169 B 0 B
build/block-library/blocks/quote/style.css 169 B 0 B
build/block-library/blocks/rss/editor-rtl.css 201 B 0 B
build/block-library/blocks/rss/editor.css 202 B 0 B
build/block-library/blocks/rss/style-rtl.css 290 B 0 B
build/block-library/blocks/rss/style.css 290 B 0 B
build/block-library/blocks/search/editor-rtl.css 189 B 0 B
build/block-library/blocks/search/editor.css 189 B 0 B
build/block-library/blocks/search/style-rtl.css 359 B 0 B
build/block-library/blocks/search/style.css 362 B 0 B
build/block-library/blocks/separator/editor-rtl.css 99 B 0 B
build/block-library/blocks/separator/editor.css 99 B 0 B
build/block-library/blocks/separator/style-rtl.css 251 B 0 B
build/block-library/blocks/separator/style.css 251 B 0 B
build/block-library/blocks/shortcode/editor-rtl.css 512 B 0 B
build/block-library/blocks/shortcode/editor.css 512 B 0 B
build/block-library/blocks/site-logo/editor-rtl.css 440 B 0 B
build/block-library/blocks/site-logo/editor.css 441 B 0 B
build/block-library/blocks/site-logo/style-rtl.css 154 B 0 B
build/block-library/blocks/site-logo/style.css 154 B 0 B
build/block-library/blocks/social-link/editor-rtl.css 164 B 0 B
build/block-library/blocks/social-link/editor.css 165 B 0 B
build/block-library/blocks/social-links/editor-rtl.css 796 B 0 B
build/block-library/blocks/social-links/editor.css 795 B 0 B
build/block-library/blocks/social-links/style-rtl.css 1.32 kB 0 B
build/block-library/blocks/social-links/style.css 1.33 kB 0 B
build/block-library/blocks/spacer/editor-rtl.css 308 B 0 B
build/block-library/blocks/spacer/editor.css 308 B 0 B
build/block-library/blocks/spacer/style-rtl.css 48 B 0 B
build/block-library/blocks/spacer/style.css 48 B 0 B
build/block-library/blocks/table/editor-rtl.css 478 B 0 B
build/block-library/blocks/table/editor.css 478 B 0 B
build/block-library/blocks/table/style-rtl.css 402 B 0 B
build/block-library/blocks/table/style.css 402 B 0 B
build/block-library/blocks/tag-cloud/editor-rtl.css 118 B 0 B
build/block-library/blocks/tag-cloud/editor.css 118 B 0 B
build/block-library/blocks/tag-cloud/style-rtl.css 94 B 0 B
build/block-library/blocks/tag-cloud/style.css 94 B 0 B
build/block-library/blocks/template-part/editor-rtl.css 552 B 0 B
build/block-library/blocks/template-part/editor.css 551 B 0 B
build/block-library/blocks/term-description/editor-rtl.css 90 B 0 B
build/block-library/blocks/term-description/editor.css 90 B 0 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B 0 B
build/block-library/blocks/text-columns/editor.css 95 B 0 B
build/block-library/blocks/text-columns/style-rtl.css 166 B 0 B
build/block-library/blocks/text-columns/style.css 166 B 0 B
build/block-library/blocks/verse/style-rtl.css 87 B 0 B
build/block-library/blocks/verse/style.css 87 B 0 B
build/block-library/blocks/video/editor-rtl.css 568 B 0 B
build/block-library/blocks/video/editor.css 569 B 0 B
build/block-library/blocks/video/style-rtl.css 173 B 0 B
build/block-library/blocks/video/style.css 173 B 0 B
build/block-library/common-rtl.css 1.31 kB 0 B
build/block-library/common.css 1.31 kB 0 B
build/block-library/reset-rtl.css 502 B 0 B
build/block-library/reset.css 503 B 0 B
build/block-library/style-rtl.css 9.44 kB 0 B
build/block-library/style.css 9.44 kB 0 B
build/block-library/theme-rtl.css 692 B 0 B
build/block-library/theme.css 693 B 0 B
build/block-serialization-default-parser/index.js 1.87 kB 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/blocks/index.js 48.7 kB 0 B
build/components/style-rtl.css 16.2 kB 0 B
build/components/style.css 16.2 kB 0 B
build/data/index.js 9.17 kB 0 B
build/deprecated/index.js 787 B 0 B
build/edit-navigation/style-rtl.css 2.86 kB 0 B
build/edit-navigation/style.css 2.86 kB 0 B
build/edit-post/classic-rtl.css 454 B 0 B
build/edit-post/classic.css 454 B 0 B
build/edit-post/style-rtl.css 6.96 kB 0 B
build/edit-post/style.css 6.95 kB 0 B
build/edit-site/index.js 28.9 kB 0 B
build/edit-site/style-rtl.css 4.9 kB 0 B
build/edit-site/style.css 4.89 kB 0 B
build/edit-widgets/index.js 16.7 kB 0 B
build/edit-widgets/style-rtl.css 2.97 kB 0 B
build/edit-widgets/style.css 2.98 kB 0 B
build/editor/style-rtl.css 3.9 kB 0 B
build/editor/style.css 3.9 kB 0 B
build/escape-html/index.js 735 B 0 B
build/format-library/style-rtl.css 637 B 0 B
build/format-library/style.css 639 B 0 B
build/hooks/index.js 2.28 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 4.04 kB 0 B
build/is-shallow-equal/index.js 699 B 0 B
build/list-reusable-blocks/index.js 3.19 kB 0 B
build/list-reusable-blocks/style-rtl.css 629 B 0 B
build/list-reusable-blocks/style.css 628 B 0 B
build/nux/index.js 3.42 kB 0 B
build/nux/style-rtl.css 731 B 0 B
build/nux/style.css 727 B 0 B
build/plugins/index.js 2.95 kB 0 B
build/priority-queue/index.js 791 B 0 B
build/reusable-blocks/index.js 3.8 kB 0 B
build/reusable-blocks/style-rtl.css 225 B 0 B
build/reusable-blocks/style.css 225 B 0 B
build/rich-text/index.js 13.5 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 3.01 kB 0 B
build/viewport/index.js 1.85 kB 0 B
build/wordcount/index.js 1.22 kB 0 B

compressed-size-action

@pbking
Copy link
Contributor

pbking commented Apr 12, 2021

Thank you Riad. The context is this:
We would like to be building themes using block-based templates and Global Styles. However most users won't be able to leverage these themes for quite some time while the Full Site Editor resolves.

In the meantime if we build only block-based themes then most users will not have access to these new themes. If we build only classic themes then... eww.

With this flag we could then build themes that target the general population and allows us to build themes the "new" way. Decoupling how themes are built and how themes are customized allows us to build themes that are useful in the FSE, and also useful in the classic environment without building the same theme twice.

There are of course other obstacles to overcome and known limitations but this gives us the option to move forward with that possibility.

Flagging that option in theme.json would certainly be a fine way to do this. If we were pointed toward an example of that being done then we would be happy to refactor.

@oandregal
Copy link
Member

👋 In terms of global styles, themes can use the theme.json mechanism independently from any other feature: as long as there's a theme.json, the mechanisms that pass configs to the editor and embed a global stylesheet work. There doesn't seem to be any difference for global styles with or without this flag. Is there anything particular you'd like to work differently?

@pbking
Copy link
Contributor

pbking commented Apr 13, 2021

The ability to use block based templates to build a theme is what we are attempting to separate from a dependency on the full site editor.

@aristath
Copy link
Member

Have you tried using remove_theme_support( 'block-templates' ); instead? 🤔

@MaggieCabrera
Copy link
Contributor Author

The idea is that a theme may want to have control over what tools the user has to customize their site. There are a few scenarios where this flag could be helpful, such as:

  • When a theme is transitioning from classic to block-based in some shape or form but we want the end-user to keep using the same tools they had to edit their site. Be it because the theme is not 100% block ready or because the theme dev decides they don't want to disrupt their established user's way of working with their theme, but still want to benefit from GS and block-based templates on their theme (be it fully or partially)
  • Have the ability to benefit from the FSE/GS tools before they are deemed "fully ready" for the end-users. Even though having this flag may look like we are turning our backs on the FSE, the intention to have it is quite the opposite. A theme may have very complex navigation or layout that can't be accomplished using GS/FSE but still want to benefit from the tools it provides from a theme dev perspective. This allows that and provides an option in the future to just remove the flag and go full FSE when everything looks right.

Potentially this flag would not be needed in the future, but we think it's a good tool for the transition period until we get there. I should have explained a bit better my PR, we just wanted to put this out there to encourage this conversation and the implementation of course may not be ideal. I'm happy to explore this as an option on theme.json of course.

@youknowriad
Copy link
Contributor

I think there's value in having the theme control what UIs to be shown to the user but right now these UIs are still in flux though, so it's going to be hard to come up with the right flags/configs (site editor might not exists as is according to the latest designs) and having a global disable-fse doesn't really make sense to me personally, FSE is a set of features and it's unclear chat is being disabled.

Curious what @mtias thinks here as well.

The other hidden question this PR raises is that you want to start building production block-based themes. While I think we're very close to that, this raises the question about the maintainability of the existing APIs. What happens if we decide to change how block templates are written or break any API. At the moment, these are experimental things and soon to be stabilized but what would be your expectations here?

@carlomanf
Copy link

Tagging @Sandstromer, because reading this reminded me of a comment they left on another issue about "crippleware" themes.

@MaggieCabrera
Copy link
Contributor Author

The other hidden question this PR raises is that you want to start building production block-based themes. While I think we're very close to that, this raises the question about the maintainability of the existing APIs. What happens if we decide to change how block templates are written or break any API. At the moment, these are experimental things and soon to be stabilized but what would be your expectations here?

Yes, that's exactly it. At some point, we need to start getting these themes in the hands of users and the way to get there is not a black or white, take it or leave it, here's the new way of editing themes, so I think it's really important that we have this conversation and I think we are about that time. I'm also curious about what @mtias thinks after our talks about universal themes, since that is what we were trying to approach with this PR, what would be a good way to leverage those kinds of themes.

In terms of the APIs, I totally see your concern and I know it may be too early to decide the form those would take place, but it's also an important conversation. The way I see it, some themes may want to surface GS to the user. Some may want to hide it, some may want to show just the template editor or neither. Those could be options on theme.json and I think they are valid options to have for themes in the future (when FSE is stable and adopted by the public) for corporate themes that may want to control what can be edited by users or not, so it's still a valid tool.

@carolinan
Copy link
Contributor

carolinan commented Apr 13, 2021

I am still trying to understand (not judging).

You want to build a block theme with the HTML templates and theme.json, but you do not want:
Templates that the user can edit, besides the standard block/post editor
Global style controls

So basically, all benefits and no worries about confused users? Like a standard theme before we had widgets and customizer options.

Except how would they add menus?

@MaggieCabrera
Copy link
Contributor Author

I am still trying to understand (not judging).

You want to build a block theme with the HTML templates and theme.json, but you do not want:
Templates that the user can edit, besides the standard block/post editor
Global style controls

So basically, all benefits and no worries about confused users? Like a standard theme before we had widgets and customizer options.

Except how would they add menus?

They would have access to the customizer and they could add the menus there. This is not meant for full-fledged block themes, but more as a transitional thing, where not all the aspects of the theme are ready for FSE or in cases where changing the UI would confuse the users.

Think about having a classic theme and you want to handle a few templates using blocks, but not all of them, or add some GS using theme.json without rebuilding the whole thing. Or think about building themes that will soon be ready to take advantage of FSE but you want to have control about the moment when your users will have access to those tools.

@carolinan
Copy link
Contributor

carolinan commented Apr 13, 2021

I think it is too soon to determine what both users and theme authors need 🤔 and that we should focus on improving the template workflows.

The risk of adding this is that developers will use it as an excuse to postpone learning about the changes, instead of getting involved.
"I don't need to learn about blocks because the classic editor plugin will be supported until 2021..." -making users and developers a disservice.

@MaggieCabrera
Copy link
Contributor Author

The risk of adding this is that developers will use it as an excuse to postpone learning about the changes, instead of getting involved.

How come? they won't need this flag if they are not already using FSE templates. And if they are, then they are already getting involved.

@carolinan
Copy link
Contributor

carolinan commented Apr 13, 2021

Then I still don't understand.
Activate Gutenberg and any classic theme without block template files in it. The user can already edit templates and template parts. This feature is enabled by default and is already opt out.

@aristath
Copy link
Member

For a transition we can have mixed templates already...
I can have for example templates/page.html as well as a page.php template in my theme.
Inside the page.php template we can do

<?php echo do_blocks( file_get_contents( 'templates/page.html' ) ); ?>

Using something like that in a "classic" theme will allow theme-authors to use HTML templates, without exposing any of the UI to users. Then, when the theme-author feels that FSE is at a stage where they can expose the UI to users, they just rename the templates folder to block-templates and they're done. No need for filters, flags or anything...

@MaggieCabrera
Copy link
Contributor Author

For a transition we can have mixed templates already...
I can have for example templates/page.html as well as a page.php template in my theme.
Inside the page.php template we can do

<?php echo do_blocks( file_get_contents( 'templates/page.html' ) ); ?>

My understanding is that do_blocks doesn't support all blocks that we have available at the moment?

@aristath
Copy link
Member

My understanding is that do_blocks doesn't support all blocks that we have available at the moment?

It's not exactly because of do_blocks... The issue is that in non-FSE themes, FSE-specific blocks (like the site-logo for example) are not exposed and therefore they don't "exist". Adding a flag to disable FSE will have the same effect btw, but AFAIK the plan is to expose all blocks regardless of whether the theme is a block theme or not.

@MaggieCabrera
Copy link
Contributor Author

It's not exactly because of do_blocks... The issue is that in non-FSE themes, FSE-specific blocks (like the site-logo for example) are not exposed and therefore they don't "exist".

Having that would definitely make this PR irrelevant, I wasn't aware of the constraints, thanks for pointing them out.

@jffng
Copy link
Contributor

jffng commented Apr 13, 2021

I think it's worth bringing up template locking in this discussion and when that may be available: #29864

If we had a mechanism via the theme.json to lock the templates entirely, I would feel less strongly about having a way to disable the site editor.

@pbking pbking mentioned this pull request Apr 20, 2021
@pbking
Copy link
Contributor

pbking commented Apr 20, 2021

Per some discussion I have refactored this to leverage theme.json settings instead of a theme_support flag.

	"settings": {
		"defaults": {
			"experience":{
				"enable_fse": false 
			},

Would be the addition to the theme.json file.
This might be more palatable than a new theme_supports.

@scruffian
Copy link
Contributor

If we imagine that we have themes which are capable of being used in the Customizer or the Site Editor (which is our hope), I think it would be useful to have some kind of toggle in the experiments section of the Gutenberg settings to enable/disable the Site Editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants