-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Template hierarchy filter: Preserve existing paths #141
Conversation
@strarsis thanks for the PR! i'm seeing some really odd behavior when trying to test FSE could you share a repo/branch with me that has sage 10 with your FSE changes applied to it? |
@retlehs: I see, yes I can prepare something that uses this patch and also has FSE features so this can be tested. |
@retlehs: Alright, this repository includes this patch, enables Gutenberg Full Site Editing/FSE and adds FSE block templates and block template parts as demonstration: |
@strarsis did you forget the link, and if so is this the one https://github.com/strarsis/sage10-fse? |
@stefanfisk: Yes, indeed! I forgot to link the repo: https://github.com/strarsis/sage10-fse (WordPress site
Activate theme. |
@stefanfisk: The repo was updated and works now with latest WordPress, Gutenberg plugin and Sage 10 theme. |
Any news on this? FSE support with Acorn/Sage would be really great. |
I'm running it fine by overriding the SageServiceProvider and not binding the template filters, so that all templates are in FSE. Running it with WooCommerce |
@oxyc: Would this be a better approach than modifying the |
To me it makes sense to not the bind the filters in the first place. I have no php templates in my theme since I opted in to FSE. I can still use blade in blocks |
@oxyc: Speaking of unbinding or short-circuiting filters, I had to force the Blade-PHP template filter to skip when a PHP-file already exists. Without this additional adjustment, some part of the HTML page markup would be rendered twice ( So ideally the Sage template filter can use Blade-PHP templates, fall back to block templates and finally usual PHP files. |
Instead of solely returning the blade template path locate result, append it to the array of existing files passed to the template hierarchy filter handler, allowing Gutenberg Full Site Editing (FSE) to find and use block templates/template parts in the (Sage 10) theme.
Allow existing files to be used instead of Blade-PHP template (notably `template-canvas.php`).
Side note/FWIW: fellow devs who still need PHP 7.x support, the |
Does this need more work to get into acorn core? |
There is a modification to one of the PR changes by @r-chrzan which appears to improve the loading behavior (Blade-PHP templates override FSE template files): strarsis/sage10-fse#1 (comment) |
Hey guys, how does this PR looks like? You think it can be merged into Acorn core any time soon? |
By the way, there is also another PR now that may handle hybrid theme situations better: #314 Independent from the particular acorn fix, you may find this Sage 10 FSE example theme base interesting: |
🧑💻 Allow blade views to override FSE templates
Awesome! 👍 |
@retlehs: Instead of solely returning the blade template path locate result,
append it to the array of existing files passed to the template hierarchy filter handler,
allowing Gutenberg Full Site Editing (FSE) to find and use block templates/template parts in the (Sage 10) theme.
This fix lets the Gutenberg Full Site Editing/FSE templates load in Gutenberg,
while still allowing classic (blade) templates to be used (as for WooCommerce that currently doesn't fully use Gutenberg yet).
Useful resources
Workaround that short-circuits the filter instead (as a fix in a Sage 10 theme): Full Site Editing (FSE) support (frontend) #228
Discussion about the reasons on why Gutenberg Full Site Editing/FSE can't find block templates/template parts without the fix:
https://discourse.roots.io/t/full-site-editing-fse-frontend-doesnt-load-template/21574/4?u=strarsis
Related issue in the Sage 10 repository (that uses this
acorn
library in its PHP runtime): Full Site Editing (FSE) support (frontend) #228PSA
Double-check whether
remove_theme_support('block-templates')
is absent from your theme setup, as otherwise FSE will not work.