With the editor it was possible for users to add snippets by using a tag like {{ datatable }} or {{ gallery }}
This does not seem to be working with blocks. What are my options for getting the same functionality?
With the editor it was possible for users to add snippets by using a tag like {{ datatable }} or {{ gallery }}
This does not seem to be working with blocks. What are my options for getting the same functionality?
To answer my own question. The easiest way I found so far was to create a custom block type per this guide Blocks | Kirby CMS
and just reference the snippet you want with with:
<?php snippet('datatable') ?>
Have I overlooked any ways that are simpler than this?
I’d say that’s the best option.
Brilliant. But - can I pass some argument to the snippet? Something like
<? snippet('my-snippet', ['var1' => 'foo']) ?>
?
If the snippet is referenced via a block, then yes, you could pass the arguments as fields inside this block.
Uhm. I tried to pass an argument using a markdown block, but it doesn’t work
(snippet:latest-tracks, [‘skipFirst’=>false])
Have you created a custom Kirbytag for that? Otherwise this will not work.
I thought you were calling the snippet via the block snippet.