- Issue created by @john pitcairn
- 🇫🇮Finland lauriii Finland
Seems like a great idea 👍 Would be happy to review a patch/MR if you have time to create one.
- 🇳🇿New Zealand john pitcairn
This would affect any existing contrib that adds a #pre_render callback to modify the element, like section_library. Are render elements expected to provide any stability in this respect?
- last update
over 1 year ago Custom Commands Failed - @john-pitcairn opened merge request.
- last update
over 1 year ago Custom Commands Failed - 🇳🇿New Zealand john pitcairn
That's a start - I added templates for the main layout builder element, and an included template for the add-section elements, with most of the logic moved into those:
@layout_builder/layout-builder.html.twig @layout_builder/layout-builder--add-section.html.twig
Not ready for review beyond that (and general approach). I'll move onto adding templates for the individual sections and their widget links within the next few days.
This WILL break any contrib currently adding a
#pre_render
function to alter the output. The way to do that with this in place will be to implementhook_preprocess_layout_builder()
,hook_preprocess_layout_builder__add_section()
, etc. Themes can just override the templates, preprocess, or both.We may need to move attribute definitions back into
LayoutBuilder::layout()
if contrib expect to have those in preprocess. - last update
over 1 year ago 29,879 pass, 3 fail - 🇳🇿New Zealand john pitcairn
We may need to move attribute definitions back into LayoutBuilder::layout() if contrib expect to have those in preprocess.
Or implement
template_preprocess_layout_builder
. Maybe add an explicit theme hook for each template instead of just using twig include(), so those have an explicit preprocess with accessible attributes and variables. - Status changed to Postponed
over 1 year ago 2:45am 28 July 2023 - 🇳🇿New Zealand john pitcairn
I think the best course of action might be to postpone this until the current initiative to improve the layout builder experience is well bounded.
Switching to a theme function and adding twig templates now is likely to collide with everything happening there.
See 🌱 [META] Layout builder editorial improvements ActiveFeedback?