Closed dsturm closed 8 months ago
@dsturm hey sorry for the delay. i'd like to look into this soon but just want to make sure it is ok if I make changes to your branch? not sure if you're using this in prod and don't want to break anything on you.
I've merged #141 and began to familiarize myself with this a bit.
In my testing, I am able to use templates
and parts
from twentytwentyfour without any issue if I remove the related blade (e.g. remove resources/views/404.blade.php
and add templates/404.html
).
I'm trying to understand if your additional code added to filterTemplateHierarchy
is still necessary. From what I gather, it may have been more of a requirement prior to Sage#3167.
Outside of that, @QWp6t and I discussed use_fse()
and Blade directives and would prefer to leave them out of Acorn for the time being. They should make a quick & easy package if someone decides to do so (or maybe Sage Directives?)
Hey @Log1x, thanks for asking. I'll check if the latest changes in acorn
and sage
have made this PR irrelevant.
@Log1x Now, as far as I can see, this PR isn't needed anymore with the latest changes in acorn
and sage
applied, so I'll close this and take a look, whether an acorn package should be created for the FSE
helper functions and directives.
Thanks again for your tireless work!
While we already have a pull request (PR) for full-site editing (FSE) support by @strarsis (#141), this PR further enhances these modifications and now supports hybrid templates (Blade-PHP and FSE block templates, currently with priority given to the latter).
Requirements theme
To enable FSE support, the theme (
sage
) requires some modifications:wp_is_block_theme()
to check for FSE themes when altering the theme hierarchy,templates/index.html
needs to exist.sage
removes theme support for FSE - we need to remove / comment out this line.wp_head()
action hook, the current position of theview(...)->render()
method is too late and would result in empty styles for rendered blocks. Therefor, we need to call it prior towp_head()
, store it in a temporary variable and echo it later.Test this PR
Optionally create a new Bedrock project
Use / require acorn fork and setup (minimal) prepared sage theme
Ideas
To use block patterns like
header
orfooter
in blade templates / views, I wrote two directives which are currently located in my preparedsage
fork, but should be located inroots/acorn
:@blocktemplate('template-part')
This will render the specified block part (i.e.
header
) and fallback, if FSE is not enabled.@parseblocks
If FSE is supported, this will render all blocks.
Questions
config/view.php
) - like enabling/disabling FSE or setting template hierarchy priority?roots/acorn
?fse:init
command for acorn which will publish stubs and ensure we do not haveremove_theme_support('block-templates')
?Useful resources