Kirby Editor Query Images

I have and am using the new Kirby Editor inside my dev environment.

Scenario:
I am editing a blog article.

I want to insert an image bellow some text, so I do the action and it puts a grey block in place that says ‘Upload Image’ or ‘Select Image’. When I click select image, it brings up the dialog for selecting an image already uploaded to the page I’m editing.

Question:
Is it possible to put a query on this so that I can query images from a photo album instead of the page I am editing?

I know it’s possible for fields etc… but they are defined in the blueprints and I have no idea how the things for the new editor are defined.

I think you can use the same image options as in the textarea field.

Do you mean adding the query to the actual editor reference in the blueprint like so?

  editor:
    type: editor
    label:
      en: Content
      de: Content
    query: kirby.page(page.gallery.toPage).images

This is the long form for a textarea field. The files option defines the set of files to select from, the upload option where to upload to. Note that it is advisable to include the images of the upload option in your files query as well.

textarea:
  type: textarea
  files:
    query: site.find("media").files.template("textarea-upload")
    image:
      cover: true
  uploads:
    parent: site.find("media")
    template: textarea-upload

I haven’t tested if this works for the editor or not, but worth a try.

Ok, so that works. Thanks for the help.

Now I understand why it is advisable to include the images from the upload options as well but how would I add that to my query bellow?

  # editor
  editor:
    type: editor
    label:
      en: Content
      de: Content
    files:
      query: kirby.page(page.gallery.toPage).images

My query is getting a value selected from another field.

You can use the add method or create a page model that merges your collections.

Try:

query: kirby.page(page.gallery.toPage).images.add(page.images)
1 Like