Output page field in blocks blueprint

I have this custom block. Here you can select a page of the template type fragment. I would like to output the title in the label so that the user knows which fragment he has selected. Fragment itself is an object in the blueprint output, but I cannot access title of fragment.

              - type: Fragment
                name: Fragment
                label: '{{ fragment.title }}'
                icon: 🧩
                fields:
                  fragment:
                    type: pages
                    text: "{{ page.title }}"
                    max: 1
                    query: site.children.template('fragments').children()

The pages field only stores the page ID/UUID. The block’s label option cannot run full Kirby queries via the PHP backend, but only has access to the raw field values from the block’s fields. This is why you cannot call .title on fragment.

Ok, I see. In this case, only fields can be output, but no queries can be triggered.

Where do I have to look if I want to change the block output of a custom block in the panel? I assume that vuejs plays a role.

Here you go:

And some examples

1 Like