I use custom blocks as “modules” for a client and now I want to create a overview page with all the available custom blocks.
I want to add some headlines to the blocks with their names but I am only able to get the block’s type into the frontend and they don’t look too nice as headlines.
Is there any way to display the block’s name instead of the type? I tried a few things but wasn’t successful.
In that case I want to display “Text Modul” as headline.
Maybe somebody has an idea how to solve this. Appreciate every hint, thanks
Have a great week!
Best regards,
Lasse
I tried to read the block’s name from the blueprint but was again only able to get the block’s type via the $page->blueprint() method (and then dig further into the object).
But as you suggested I created a key/value array. Should do it’s job for now
I meant from the block blueprint, not from the page blueprint, but I don’t think performance-wise this is such a great idea, because you would end up reading a lot of blueprints.
Another idea could be to create block models for each block, but that seems to be overkill for something like this as well.
Ahh!
I have a hard time to access the block’s blueprint.
I tried (as mentioned before) with the $page->blueprint() method
and with looping over $page->modules()->toBlocks() as $module
and then accessing it with $module->blueprint()
but all I get is this: