Access values of query in structure field

How can i display a value of query in structure field?

My blueprint looks like this:

 sammlung:
label: sammlung
type: structure
fields:
  bild:
    label: Bild
    type: select
    required: true
    options: query
    query:
      page: bibliothek/werke
      fetch: children
      value: '{{title}} {{image}}'
      text: '{{title}}'

My code like this:

  <?php foreach ($page->sammlung()->toStructure() as $bild): ?>

  <li class="showcase-item column">

    <a href="<?= $bild->image()->url() ?>" >

          <img class="immy" src="<?= $thumb->url() ?>"/>

        <div class="buname">
          <?= $bild->title()->html() ?>
        </div>
        <div class="bu">
          <?= ($p = $bild->kuenstler()->toPage())? $p->title(): ''?>
        </div>

    </a>

  </li>

<?php endforeach ?>

You should store the URI of the page in the field, not the title and image. Value is what get’s stored in the content file, text what is shown to the user. With your current storage value, toPage() will not find a page.

Also, I don’t see a field called kuenstler in your structure field? So it should be $bild->bild()->toPage() after you have fixed your value.

Ah, thanks! Now i got it :slight_smile: