I'm trying to achieve some modularity using embeds, but with the possiblity to extend/inject customizations from the including template.
Consider the following scenario:
Have a modular partial which contains a form, say form.twig
I want the ability to add new form fields at the end of the form, but using the otherwise common form.twig, so I add a {% block form_extension %}
in form.twig
I have another page template, that includes/embed that partial, say page.twig
. Now, this works, I just add a block when embedding, and it gets injected.
But, I also have another modular partial, say partial_with_form.twig
, that embeds form.twig
. And I want to be able to define the form_extension
block, when embedding partial_with_form
.
Is this even possible? I have tried with parent() and block(), but none of them can give me the content of the supplied block unless I specify the targeting block in partial_with_form. But then it will be outputted there...