Select field's key/value

Hello,
I Need to access a select fields key and value, I guess possibly with the new ‘blueprint()’ function- but havent seen it in the guide / docs…

https://getkirby.com/docs/cookbook/templating/using-blueprints-in-frontend

Ofc, cookbook… Thx!

… and if it’s inside a structure field? I don’t seem to get it right … what I got is this:

<?php
  $hosts = $page->hosts()->toStructure();
  foreach ($hosts as $host) :
?>

<span><?= $page->blueprint()->field($host->host())) ?></span>


<?php endforeach ?>
          hosts:
            label: Available hosts
            type: structure
            sortBy: host asc
            fields:
              host:
                label: Anbieter
                type: select
                options:
                  amazon: Amazon
                  apple: iTunes
                  soundcloud: SoundCloud
                  spotify: Spotify
                  youtube: YouTube
              link:
                label: URL
                type: url

… and what I want is to show ‘iTunes’ (value) instead of ‘apple’ (key).

So what I meant was how to get an option’s value :slight_smile:

That would be

dump($page->blueprint()->field('hosts')['fields']['host']['options']['apple']);
2 Likes