Select/Multiselect options from config

Suppose I have a list of categories for a select: these are used in both panel, and on frontend. What’s the best way to manage them in one place, so I am consistent in what’s shown as a label on the frontend and in panel?

For PHP, it’s simple option('namespace.categories')[$category]

For Panel, I’m not sure.

options: query
query: config.namespace.categories
query: options.namespace.categories
query: option.namespace.categories

Neither does work.

The format of the array is [{value} => {label}], but I suppose I am flexible here: I just want to manage the options for the select in one place.

You can use kirby.option

 query: kirby.option('categories')
1 Like

@texnixe, you’re the loveliest person of them all.

For those who land here, this is the final form, creating tags from array of {slug} => {title}:

query:
  fetch: kirby.option('namespace.categories')
  value: "{{ arrayItem.key }}"
  text: "{{ arrayItem.value }}"
3 Likes