Custom block doesn't work: no drawer with fields

Hello everyone :slight_smile:
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:


Kirby::plugin('TERK/infoitem-block', [
  'blueprints' => [
    'blocks/infoitem' => __DIR__ . '/blueprints/blocks/infoitem.yml',
  'snippets' => [
    'blocks/infoitem' => __DIR__ . '/snippets/blocks/infoitem.php',

my plugin folder looks like this:

Screen Shot 2022-08-28 at 12.39.46 PM

and my new block item yml looks like this:

name: infoitem

    type: fields
        type: text
        type: text
        type: text

What am I doing wrong?
Thank you!

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:

panel.plugin("TERK/infoitem-block", {
    blocks: {
      infoitem: {
        template: `
            <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
like this:
Screen Shot 2022-08-28 at 5.11.30 PM

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
Screen Shot 2022-08-28 at 5.44.51 PM

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)

name: infoitem
preview: infoitem

  # rest of stuff
1 Like

Amazing! it works now!
Thank you so much!