How to use blueprint query results as value for a field setting?

Some fields in my blueprint do not make sense when a specific page option is set. I thought about disabling these fields when a condition is met. The condition (in a page method) has the correct string value (true or false) as can I see in the debugging label output.

But how does it work in conjunction with the disabled setting of a field? Currently, the teaser field is always disabled and independent from the redirect value of a page.

My page model:

<?php

Kirby::plugin('rzschoch/page-methods', [
  'pageMethods' => [
    'isRedirectEnabled' => function() {
      return $this->redirect()->toString();
    }
  ]
]);

The blueprint snippet:

type: group
fields:
  teaser:
    type: select
    label: "Mit welchem Element soll die Seite eingeleitet werden? {{ page.isRedirectEnabled }}"
    default: none
    translate: false
    disabled: "{{ page.isRedirectEnabled }}"
    options:
      none: Mit keinem Element
      image: Mit einem Einzelbild
      gallery: Mit einer Bildergalerie

Why don’t you hide the field conditionally using when if it depends on another field value?

https://getkirby.com/docs/guide/blueprints/fields#conditional-fields

type: group
fields:
  teaser:
    type: select
    label: "Mit welchem Element soll die Seite eingeleitet werden? {{ page.isRedirectEnabled }}"
    default: none
    translate: false
    when:
      redirect: false # only show this field when redirect is false
    options:
      none: Mit keinem Element
      image: Mit einem Einzelbild
      gallery: Mit einer Bildergalerie

For me, this only works in parent blueprints (like pages/default.yml), not in section snippets (like sections/page-content.yml). I try to build universal blueprint snippets which decide for themselves what to show.

Your solution would work (but then I always need to adapt the parent blueprint to the extended snippet):

title: Default Page

columns:
  - width: 1/2
    sections:
      pageOptions:
        extends: sections/page-options
        fields:
          pageTitle:
            when:
              redirect: false
      pageContent:
        extends: sections/page-content
        fields:
          teaser:
            when:
              redirect: false
  - width: 1/2
    sections:
      pages:
        extends: sections/pages
      files:
        extends: sections/files

Are dynamic values for other field options than (for example) select field options possible or do they need to be prepared internally?

@rzschoch @texnixe any updates on this? I have the exact some problem, trying to set disabled on a field on a condition.

No, queries are still not possible for the disabled property. Also creating blueprints based on PHP won’t help if you need to access values on the same page. It would work based on a fixed page that you can fetch by its ID or the site object.