Query language — menu builder

Hi everyone,

For a menu builder I want to restrict the choices of the sub pages, to the children of the first level pages chosen in the same structured item.

mainmenu:
    label: Menu
    type: structure
    fields:
        firstlevelpage:
            label: First level
            type: pages
            max: 1
        subpagesselector:
                label: Second level pages… children of the first level
                type: pages
                query: ???

Thanks.

Laurent

That is not possible without a custom implementation.

Thanks for your swift answer.

At which level, if I may ?

What do you mean?

Sorry…

I mean at wich level should it be a custom implementation ?
Should I investigate towards the Kirby Query Language (KQL) plugin ?

L

No, KQL is for querying data from your Kirby installation via API.

Here, you want one field inside a structure to listen to changes in another field inside the structure and then filter the list of options for this second field.

So in my opinion, you probably need a custom field consisting of two subfields, where one subfield listens to the other and then makes a query to the backend to get a list of results. Or maybe a single field is enough, no sure.

Thanks for the tips. I’ll investigate in that direction.

L