Displaying Block elements on the Front Page

how do you display block elements on the frontpage? And i don't mean the preview file. I want to access the block elements like $item->block like that.
5 Replies
ifox
ifox2y ago
$item->blocks is a collection of blocks
.zeenux
.zeenuxOP2y ago
so would $item->blocks('ckeditor')->render() would do the trick? because it doesn't for me
ifox
ifox2y ago
no that would be $item->renderBlocks() or renderNamedBlocks('block_editor_field_name') what are you trying to do with that ckeditor parameter though? Is that the name of one of your blocks?
.zeenux
.zeenuxOP2y ago
yes for instance i have a wysiwig editor and an image and a textbox in the blockeditor. I want to render all three of them in my template
ifox
ifox2y ago
so a subselection of blocks by their type? In that case you can do $item->blocks->whereIn('type', [...])->get() and iterate over that collection to include the view you want to render for each block type.
Want results from more Discord servers?
Add your server