Querying from site.txt

I’m trying to use the “Option from other field” method as described for checkboxes in the doc: https://getkirby.com/docs/cheatsheet/panel-fields/checkboxes

However, I cannot query from site.txt.

This is what I tried:

tasks:
    label: Tasks
    type: checkboxes
    options: field
    field:
      page: site
      name: project_tasks
      separator: ,

but it causes a fatal error.

Maybe it’s only possible to read from other pages’ fields? Reading from site.txt would be really useful for sitewide options.

Ideally, I was looking to use queries, and even more ideally, from a structure field in site.txt as already once described by @rhawbert in Panel: querying “site.txt” structure fields as pages/subpages fields’ values. But that doesn’t seem to be implemented.

Any idea? Thx!

You can do it like this:

tasks:
    label: Tasks
    type: checkboxes
    options: field
    field:
      page: /
      name: project_tasks
      separator: ,

Edit: If you want to query a structure field, you can only do that either with a custom field or by creating an API from the structure field via a hook.

1 Like

Cool, thx! I had only tried /site but not just the slash.