I try to create a custom block, I call it “info-item”. I need to have a block that has 3 text fields in it.
Therfore I followed this tutorial.
the problem is: when I try to add this info-item block in the panel it doesn’t show the drawer, it just adds a new empty block line with no option to edit.
I suspect I’m doing something wrong in the index.php file of the plugin, it looks like this:
'blueprints' => [
'blocks/infoitem' => __DIR__ . '/blueprints/blocks/infoitem.yml',
'snippets' => [
'blocks/infoitem' => __DIR__ . '/snippets/blocks/infoitem.php',
my plugin folder looks like this:
and my new block item yml looks like this:
What am I doing wrong?
You cannot use
sections in a block yaml.
Wow thanks so much! it works perfectly :)))
Another small issue I’m having with custom blocks.
I try to customize it’s appearance in the panel so I use the index.js file like this:
<div><p>yo yo yo</p></div>
But for some reason - nothing changes. it just show me the name of the block.
Any idea why?
Should work. Where did you put your index.js?
next to index.php
Hm, that’s weird. From what you copied here, the plugin name seems to be identical in index.php and index.js, but double check just in case.
Which Kirby version are you using?
the names are identical
by the way - I get these messages in the console:
maybe it can help?
(I added the hiii just to see if it even reads the file)
The "Plugin is replacing “k-block-type-markdown” is just a debugging message, probably comes from the markdown field plugin?
Again, which Kirby version are you using?
ah that’s right - I use this plugin too…
I think it’s 18.104.22.168
That’s what the composer.json in the kirby folder says
Try to set the preview in your block yaml (shouldn’t be necessary, but maybe it is in your older version)
# rest of stuff
Amazing! it works now!
Thank you so much!