How to use query in combination with kirby-builder?

I’ve got a situation where i try to query some tags from the siblings, but i’m not in a regular page but in a kirby-builder structure. How can i use query in this situation?

Blueprint:

    fields:
      mybuilder:
        type: builder
        fieldsets:
            tabs:
                content:
                    fields:
                        headline:
                            type: text

                        entries:
                            type: builder
                            fieldsets:
                                entry:
                                    fields:
                                        tags:
                                            type: tags
                                            options: query
                                            query: page.siblings.pluck("tags", ",", true)

This is a builder field within a builder field.
I expected the query page.siblings.pluck("tags", ",", true) to contain the tags from the siblings, but the query result is always empty.
How to debug?
How to find out about the siblings of builder fields?

Thank you very much
Andreas

Yes, that doesn’t make sense. I think in this case, you better create a page model that extracts the tags from the nested builder fields and returns them as an array.

I assume your blueprint is not quite complete, because addings tags in a nested structure seems somehow weird,

Well, why weird. Its for adding portfolio items. The items are in the nested builder structure, whilst the rest is in the main part like the headline of the whole thing and such stuff.

The only solution i found to work out of box is defining the tags in the site settings with a tags field, and then referencing them in the nested builder with query: site.portfolio_tags.split.

That’s why I asked if the blueprint was complete…

As I said, you can fetch the values somehow, but not with the query language, but use the API and provide a route that extracts the tags and returns them.

So the problem is, that i can not access builder items with a query in the page-Object?
Is this a limitation of builder?
Is it generally possible to use a query to gather data from the siblings in a structure?

No, you could in the same way as you can access structure items. But you can’t handle this complex structure with the Panel query language.

You could use pluck() to get all entries in one structure, for example, but that doesn’t get you the tags within those entries and it doesn’t get all entries of all siblings.

1 Like

Thank you very much for your world class support and the quick replies :slight_smile:
My current solution defining the possible tags globally (in site settings) and referencing them in the nested builder structure seems good enough for now. I stay with this …

It’s a lot less complicated, that’s for sure.