Fetching data from another page in select query

Hi.
I’m currently building a site for a photographer that consists of a gallery page which is a parent page to multiple photo pages. I would like to give him the ability to tag a photo with a selection of pre-set categories (using the multiselect plugin).

In the gallery page I’ve created a structured field for him to specify the names of the categories he’d like to tag his pictures with

Now, on the photo page, I’d like to know if it’s possible to pull through these categories into a select query, so that a nice checklist appears with those previously specified category names – i.e.:

categories:
  label: Categories
  type:  multiselect
  options: query
  query:
    page: gallery
    fetch: [categories?]

(note: he wants the ability to tag a photo with multiple categories such as landscape and black & white)

Thanks!

That’s not possible out of the box. You would have to create your own field. Since you are already using a custom field, you can use this a a basis and extend it to support your categories options.

Or, you could write the options of the structure field to a json file which you can then call via its URL.
External API support for dynamic field options

You can now simply pass a URL for options to fetch a JSON array with keys and values for options:

  label: Select field
  type: select
  options: http://myoptionsapi.com/options.json

http://getkirby.com/changelog/kirby-2-1-0