I’d like to filter an array in a blueprint query in kirby 3.6. The idea is in the first step to select a set of tags from a global options array (to narrow down options for step 2). Step 2 is to select from the narrowed down array into a structure field. The thing is that I want to kind of sort them and remove already used tags from the list of available tags. So tags can only be used once inside the structure rows.
The page blueprint looks like the following. The structure needs a page refresh before the selected options become available with everything in one yml. The main problem however is how to filter the arrays without having to create a whole new plugin.:
title: Sandbox
fields:
ids:
type: multiselect
options:
- A
- B
- C
- D
- E
- F
- G
sorted:
type: structure
fields:
tags:
type: multiselect
options: query
query: # how to combine the following 2 queries?
# query step 1, narrowed down ids: page.ids.split(",")
# query step 2, already used ids: page.sorted.toStructure.pluck("tags", ",", true)
# works for collections, but not arrays: page.ids.without(page.sorted)
# equivalent in php, not KQL: array_diff($all_ids, $used_ids)
As far as I understand, page methods/models are only for access in the template, but not in the panel. I want to avoid writing an extra plugin for this, but it seems the learning curve is getting steep quite quickly.
Any ideas are appreciated. I’m new to kirby, please give me the idiot proof explanation, thank you!!!