Scottnj - Can component blocks be nested inside...
# ❓questions
s
Can component blocks be nested inside other component blocks? I have a "heading" component block that works fine on it's own. I have a "row" component block that renders nested (regular, non component) blocks fine. When I nest the "heading" component block inside the "row" component block, I get the error:
Copy code
An error occured trying to render:
View [site.blocks.app-heading] not found. in /var/www/html/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php
My "row" is very simple
Copy code
php artisan twill:make:componentBlock row
Copy code
BlockEditor::make()->name('content'),
Copy code
{!! $renderData->renderChildren('content') !!}
i
hi @Scottnj content is not a children per se, so renderNamedBlocks would be more appropriate here
s
I can't find any info on renderNamedBlocks in the guides or docs. I can't figure out how to call it, I keep getting errors for everything I can think of. How would I call it from my component block's blade file?
renderNamedBlocks is listed here, but I don't think that's what you're looking for.
If nothing from this page helps, I'll spend some time reproducing your use case https://twillcms.com/docs/block-editor/nested-blocks.html
s
Thanks for the links, but I still cannot get it to work. If it helps, here is a barebones twill app that is giving me the problem. The only things done to create it are what's in the readme.md. It has the component blocks already setup. https://github.com/scottnj/example-app The bottom of the readme shows the errors I am getting.
i
lovely, thank you for providing that
s
Thank you for helping me out!
I did some reading and more trial and error for a while this afternoon, still couldn't get it to work. I'm not sure if I'm just doing something wrong, or if it's not currently possible.
i
Hi @Scottnj I have tested your repo and was able to make it work by tweaking the location of your view and not using the helpers like $input() but using $block->input() instead. But this is actually entirely solved by this PR I just merged: https://github.com/area17/twill/pull/2243. I will release 3.1 this week with this fix. Already tested the 3.x branch and
$renderData->renderChildren()
works immediately and renders infinitely nested blocks
s
Hi @ifox , THANKS!!!