Display diagnostics about fields

Is there a way to show ‘diagnostic information’ about another field?
For example something like this

isEmptyNotice:
  type: info
  text: MyStructure cannot be empty!
  when: myStructure.toStructure.isEmpty

This way one can add notice about incorrect fields instead of ‘forcing’ the user by adding field limitations

This type of when condition is currently not possible.

I know (I already tried). But is there any alternative way to achieve something like this?

You can use a min: 1 validator on the structure field to make sure the structure field is not empty.

That is true, but sometimes you don’t want to do that, since Kirby hard-forces these limitations while in some cases these limitations are a recommendation rather than a hard-limits.

One could document it thoroughly, but for larger blueprints it might be handier to have an ‘overview’/‘notification’ of some sort consisting of these kind of info-elements.

Why don’t you use help text for these purposes?

does it show upon ‘non-recommended-input’? if so, how is that done?

No, help text is always there under the field. But wouldn’t it make sense to tell the user in advance that input is recommened rather than as an afterthought? Maybe you could even make this work with a page model…

Alright, to give a little more context.

I currently have a situation where multiple fields (all with various types, inside structures and outside structures) have a relationship to eachother. Depending on one input, the recommendation of another field changes.

I can give a full documentation of all those relationships (meaning a full page of explanation for a full page of settings). That documentation will defenitly be somewhere, but to make it more usable for an end-user I thought of adding ‘checks’ which notifies the user if they specified values which are not recommended for the current relationship.

I know the Query language is a thing, so is there a way to use that for a ‘when-like’ blueprint parameter? I don’t mind adding custom methods via plugins declarations etc. but I would prefer not to use custom fields if possible. That is why I asked about alternatives to this (non-existing?) mechanic

There are probably ways to achieve this via hidden fields, hooks and custom methods. Those hidden fields would get a value depending on conditions and the values of these hidden fields could then be used for conditional fields.

when:
  hiddenfield: somevalue

If you then use a page model as content for your condtional info field, you can get as complicated as you want.

As already suggested by others, simplest way is to write a custom function in a page model (for a certain page template) or a page method (for all pages) and call it in the blueprint:

info_example:
  headline: Dynamic page fields info
  type: info
  text: "{{page.checklist}}"
// e.g. site/models/template-with-checks.php
public function checklist() {

    $checklist  = '<ul>';

    foreach($this->blueprint()->fields() as $field_key => $field) {
        // react on empty or whatever factors you want to check, e.g.:
        if($this->$field_key()->isNotEmpty()) {
            $checklist .= '<li style="color:green;">✔ '. $field['label'] .'</li>';
        } else {
            $checklist .= '<li style="color:red;">❌ '. $field['label'] .'</li>';
        }
        // ...
    }

    $checklist .= '</ul>';

    return $checklist;
}

Caveat is, that the info section only reflects updated content when the page got saved and the panel page reloaded.
You would need to write a plugin and a custom section to reflect changes instantly.

Thanks for all the replies. This gives me a few options to think about indeed.
Fun to see that page-methods also works within the panel, didn’t expect that one