# Problems with blueprint query and custom data

**URL:** https://forum.getkirby.com/t/problems-with-blueprint-query-and-custom-data/24523
**Category:** Questions
**Tags:** v3
**Created:** [January 20, 2022, 10:14am UTC](https://forum.getkirby.com/t/problems-with-blueprint-query-and-custom-data/24523 "2022-01-20T10:14:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![owzim](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/owzim/32/12457_2.png) [@owzim](https://forum.getkirby.com/u/owzim)
#### Post date: [January 20, 2022, 10:14am UTC](https://forum.getkirby.com/t/problems-with-blueprint-query-and-custom-data/24523/1 "2022-01-20T10:14:48Z")

</div>

So I have this custom site method:

```php
return [
    'custom' => function()
    {
        return [
            'fooKey' => 'Foo',
            'barKey' => 'Bar',
            'bazKey' => 'Baz',
        ];
    },
];

```

This in the blueprint

```yaml
fields:
  category:
    type: radio
    options: query
    query:
      fetch: site.custom

```

The options seem to be be processed like an array, and not like this:

```yaml
fields:
  category:
    type: radio
    options:
      fooKey: Foo
      barKey: Bar
      bazKey: Baz

```

So the actual keys (the values to be saved to the page) get lost and only the text is saved

I also tried returning it differently:

```php
return [
    'custom' => function()
    {
        return [
            [
                'key' => 'fooKey',
                'value' => 'Foo',
            ],
            [
                'key' => 'barKey',
                'value' => 'Bar',
            ],
            [
                'key' => 'bazKey',
                'value' => 'Baz',
            ],
        ];
    },
];

```

or

```php
return [
    'custom' => function()
    {
        return [
            [
                'value' => 'fooKey',
                'text' => 'Foo',
            ],
            [
                'value' => 'barKey',
                'text' => 'Bar',
            ],
            [
                'value' => 'bazKey',
                'text' => 'Baz',
            ],
        ];
    },
];

```

But either errors about an invalid format are thrown or be above described array conversion takes place.

I also played around with the mapping options (with different context names [arrayItem, structureItem and so on):

```yaml
query:
  fetch: site.custom
  text: "{{ arrayItem.text }}"
  value: "{{ arrayItem.value }}"

```

To no avail.

Thanks for any help in advance.

---

<div class="post-metadata">

### Author: ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)
#### Post date: [January 20, 2022, 10:29am UTC](https://forum.getkirby.com/t/problems-with-blueprint-query-and-custom-data/24523/2 "2022-01-20T10:29:23Z")

</div>

Your first site method version and then:

```auto
      category:
        type: radio
        options: query
        query:
          fetch: site.custom
          text: "{{ arrayItem.value }}"
          value: "{{ arrayItem.key }}"

```

---

<div class="post-metadata">

### Author: ![owzim](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/owzim/32/12457_2.png) [@owzim](https://forum.getkirby.com/u/owzim)
#### Post date: [January 20, 2022, 10:34am UTC](https://forum.getkirby.com/t/problems-with-blueprint-query-and-custom-data/24523/3 "2022-01-20T10:34:46Z")

</div>

Thanks, that worked!
