Dynamic values for Kirby 4 Color field?

I’m trying to convert from a color-palette field type to the new color field type in Kirby 4. This yaml is used with extends. What’s the proper way to pull in an array of colors from the config?

In the code below customizable.palette-options is defined in the config file.

label: Color
type: color
options:
  type: query
  query: kirby.option('customizable.palette-options')
  key: "{{ arrayItem.key }}"
  value: "{{ arrayItem.value }}"
width: 1/2

Doesn’t seem to work. Alternative for the moment could be a PHP field blueprint.

I am in the same position now, needing to load the options of a color field from a structure defined in site.yml. Can you elaborate what you mean by “PHP field blueprint”, Sonja?

Thank you!

You can create Blueprints in PHP instead of yaml, see Programmable blueprints | Kirby CMS

2 Likes

@texnixe Thanks! This is a great work-around until the field supports the KQL.

Here’s what my field definition looks like right now:

1 Like