Closed tito10047 closed 2 months ago
First thing: I'm not sure you should create a Twig component for your entire body.
In your layout.html.twig, you use a block "body" than you never defined... The twig:Body component is a .. component, and the fact it could work calling it body is nothing documented, and that could change at any time.
Is there any reason here that prevent you to use standard twig blocks ?
Its not about component Body. Its only simulation of problem. But In my aplication have similar component Layout where I want have logic which layout I want use. So aproach is similar and problem is same.
And why im using components? I want build universal template for all my projects. I think components are suitable for this.
So should I take it as saying that this cannot be done with twig components?
Its not about component Body.
Just saying you have no outer blocks in this template. so this wont work.
<twig:Body>
{{ block(outerBlocks.body) }}
</twig:Body>
So should I take it as saying that this cannot be done with twig components?
I'm saying this is much easier with twig regular blocks / extends / embeds... Twig is the perfect tool to build layout structures with inheritence, etc... TwigComponents are made to have PHP-based capabilities in an isolated scope.
But i like props in twig comnponents. With it I can simply modify the view. I dont need to remmember all classes, just set the props and everything in template is hapening.
But thanks for your time, I will switch to classic blocks
Hi, I have this situation:
When i want render
index.html.twig
thencontainer
block is not renderedAny idea how to render this block ? Thanks