Use Content from Structure in Dynamic Select Field

I am trying to query a Structure Field in a Dynamic Select Field with:

  label: Standort
  type: select
  options: query
    page: standorte_termine
     fetch: location
     text: '{{description}}'
     value: '{{key}}' 

The Structure Field itself looks like this:

  label: Standort
  type: structure
  entry: >
      label: Eindeutige Bezeichnung
      type: text
      label: Standort
      type: text

and is of course on page “standorte_termine” but it does not work. How can that be achieved? Because unfortunately I am getting not closer with and other Posts.

That is not possible out of the box, but there is a plugin for that.

Thx for the fast solution!

That’s a sweet plugin.

Buts, is it possible to fetch the entire entry with all its fields at once?

In example, I want to pick a contact entry storing different infos (office name, address, phone number, etc.) among different contact entries.

The problem is that the individual entry has no key by which you could select it, hence it does not make sense. But what you can do is this:

1 Like

This is even better than my initial request.

I only have a dumb problem, which is:
if I use a $var inside the findBy($x, $var) function, I don’t get any output.

If I replace it with a hardcoded value, it works.


<?php $selected_contact = $page->contacts(); ?>
<?php $contacts = $pages->find('contact')->contact()->toStructure()->findBy('office', $selected_contact); ?>

<div><?= $contacts ?></div>

$page->contacts() outputs the value added by the select-a-structure kirby field.


using filterBy() did the trick.

<?php $contacts = $pages->find('contact')->contact()->toStructure()->filterBy('office', $selected_contact); ?>

Please note that filterBy() returns a collection, not a single entry, whereas findBy() just gets the first entry.