How to create autocomplete tag field with options pulled from multiple structure fields on another page?

Is it possible to pull values from tag fields from multiple structures as options for an autocomplete tags field on another page?

Here is my blueprints

Home blueprint:

sections: 
      fields: # a fields section with any number of fields
        type: fields
        fields:
          checkboxes:
            type: structure
            label: Checkboxes
            fields:
              agendas:
                type: structure
                label: Agendas
                fields:
                  tag:
                    label: Tags
                    type: tags
                    max: 1
              tools:
                type: structure
                label: Tools
                fields:
                  tag:
                    label: Tags
                    type: tags
                    max: 1
              interfaces:
                type: structure
                label: Interfaces
                fields:
                  tag:
                    label: Tags
                    type: tags
                    max: 1

Project Blueprint:

sections: 
      fields: 
        type: fields
        fields:
          key:
            type: text
            width: 1/2
            label: Key(s)
            help: Key words for filtering projects

Yes, but you cannot do that directly in the query language, but have to create a custom page method that combines the fields, or alternatively do it in a route that you can then use in a query from API.

Thank you for this! Can you recommend any resources to look at? Not too sure how to begin with this

Multiple structure combined into one: Difficulty merging structures into a collection

Route: https://getkirby.com/docs/guide/routing
Custom page method: https://getkirby.com/docs/reference/plugins/extensions/page-methods
So:

  1. Create a route with a pattern of your choice.
  2. Either create a page method that returns the combined structure field, or create a route that return the json you need, I think the page method is probably easier.
1 Like