Get Custom Block's ID from inside a field in the panel

Hi everyone!

On a website I defined some custom block blueprints.
Inside of these blocks I have info fields for guiding the editor and explaining how that particular block works inside the panel.
In the info field’s text I want to access the associated custom block’s id, to link to an anchor on an internal custom block overview page (where the block ids are used for on page navigation).

I tried some things like

        type: info
        text: >
          {{ }}


{{ }}

and a couple other things. But that doesn’t seem to work.
I also would like to access the block’s type to load a particular screenshot.

Is it possible to access info about the block inside a field?

I am using the newest Kirby 4 Beta.

Thank you very much :slight_smile:

Hm, I’d say at the time the block is about to be created, and when the user would need this information, the block id is not defined yet, but only when the block is stored.

Thanks for your fast answer :slight_smile:

Okay! That’s understandable. What about the block’s type?
I was thinking about storing screenshots of every custom block in a folder and name the screenshots by the blocks’ types. So I can access the right screenshot from the panel inside the block. Would that be possible (without custom plugins)?

No, I don’t think you have access to that either, but on the other hand you know your block type when you add the info field in your block type blueprint anyway, so might as well hard-code the type?

    type: info
    text: <a href="{{site.url}}/blocks/mycustomblock">Check out an example block preview</a>

Hi Sonja,

ahh, yes, of course! That totally works, I really did not think about just hard coding it in the first place.
Sometimes have 30+ custom blocks per project (all extending the same base block blueprint), I thought to maybe achieve a “one line” result. But if you can’t access these infos, hard coding is totally fine.

Thanks again and have a great weekend! :slight_smile: