PHP Error with Site Field Setting Fetching Siblings

Hello Kirbies

I just encountered a PHP error when adding the following to my site’s blueprint files…

  product_checkouts:
    label: Product Checkouts
    type: structure
    fields:
      product_checkout_page:
        label: Checkout Page
        type: select
        options: query
        query:
          page: /
          fetch: siblings
          template: checkout

… where the culprit is fetch: siblings; as soon as I remove this line or change it to, e.g., fetch: children all works again. Any hints?

Thanks a lot,
Moritz

Yes, I can reproduce this. It’s probably a bug, not a feature. I have created an issue on GitHub.

Does this only happen in structure fields or standard fields as well?

What are you trying to achieve with fetch: siblings in the root level?
By using page: /, you are basically getting the $site object, whose children are the top-level pages. It has no siblings, because there is only one $site.

Using fetch: children should be what you want, shouldn’t it?

Oops, bad thought. I intended to get all pages and filter them by template.

So does

  product_checkouts:
    label: Product Checkouts
    type: structure
    fields:
      product_checkout_page:
        label: Checkout Page
        type: select
        options: query
        query:
          page: /
          fetch: children
          template: checkout

work for you?

Yes. And even what I wanted to achieve in the first time:

      product_checkout_page:
        label: Checkout Page
        type: select
        options: query
        query:
          page: /
          fetch: pages
          value: '{{id}}'
          text: '{{id}}'
          template: checkout

This results in a select field with all pages of type checkout.

2 Likes