I have a tag
field inside a structure
field. I’d like to autocomplete this field by querying all of the other pages. I’ve done this successfully many times with tags, but never from inside a structure
field.
locations:
type: structure
fields:
kiez:
type: tags
options: query
query: page.parent.childrenAndDrafts.pluck("kiez", ",", true)
max: 1
This does not work. How do I get the query to look inside the structure field?
texnixe
October 29, 2020, 6:11pm
#2
I think you need a custom method to achieve this, pluck only works with single value fields or fields with comma etc. separated values.
I tried calling a custom site method which returns an array, but that didn’t work. like query: site.getItems
where getItems
basically is like:
$array = $this->someField()->yaml();
return A::pluck($array, ‚tags‘);
(Strange apostrophes due to me typing on iOS)
Did it much like you described here …
texnixe
December 11, 2020, 3:58pm
#4
That should actually work, what is your Kirby version? And what’s in your blueprint?
Well, oddly it does now … Guess it was restarting PHP that must’ve worked