How to use a page-method in the blueprint?

Hi,

im am trying to set the image-ratio of a files-field in the blueprint by custom page-method.
The idea is to get the settings for the current page, or falling back to parent- or site-settings if not set on the page.

It´s basically working by getting a page-object via the file-object:

files:
  type: files
  layout: cards
  image:
    ratio: "{{file.parent.getCoverRatio()}}"

Unfortunately this returns the page-object of the page where the file is stored, and not the page where the image is used.

The following syntax is not working for me (kirby 3.6.0.beta.3):

files: 
  ...
  image:
    ratio: "{{page.getCoverRatio()}}"

How can I use the page-method directly in the blueprint?

Cheers
Peter

According to your field settings (since you are not using a query), I would assume that the file is stored where it is used?

Sorry moonwalk, the query was left out:

files:
  type: files
  layout: cards
  image:
    ratio: "{{file.parent.getCoverRatio()}}"
  query: site.find('photography').children.images
  ...

Site methods do work too:

files:
  ...
  image:
    ratio: "{{site.getCoverRatio()}}"
  ...

Why not

ratio: "{{page.getCoverRatio()}}"

The blueprint doesn’t know what page is in this context. You can only get information in relation to the file, i.e. file.parent or via a file method.

Why is that?

We can use the page object in other fields like:

published:
  headline: Published Pages
  type: pages
  info: "Year: {{ page.year }}"

Or:

tags:
    label: Tags
    type: tags
    options: query
    query:
      fetch: page.siblings
      text: " {{ page.title }}"
      value: "{{ page.uri }}"

According to: Query Language | Kirby CMS

Yes, but there you are in the relevant page contexts, whereas in a files field/section, you are in the context of the file.

Ok, but the field/sections is defined in the context of a specific page-blueprint.
:confused:
:scrapping my head:

So, the page-object is not passed down into the files-field?