Dynamic options fetching field from other page

I want to set the ability of editors to publish stories via toggle field.
The pages to be published are of type story.
The toggle field is in a panel page called options, accessible only to admins.
And that’s what I tried so far, but doesn’t work:

# site/blueprints/pages/story.yml
…
options:
  changeStatus:
    admin: true
    editor: 
      query: site.find('options').editorsPublishingRights.toBool()


# site/blueprints/pages/options.yml
…
fields:
  editorsPublishingRights:
    label: Editors can publish stories
    type: toggle

A query doesn’t make sense.

But the option doesn’t accept a query value, I think, but just true or false. So

editor: "{{ site.find('options').editorsPublishingRights.toBool() }}"

wouldn’t work, either.

No it doesn’t. That’s among the things I have tried (in all its possible forms)

editor: site.find('options').editorsPublishingRights
editor: site.find('options').editorsPublishingRights.toBool()
editor: "{{ site.find('options').editorsPublishingRights }}"
editor: "{{ site.find('options').editorsPublishingRights.toBool() }}"

I was hoping queries could be used anywhere instead of values.

I didn’t say it does!

Those options do not accept the query language.

hehe yes, I was just confirming that (:

Would you or anyone else have any other suggestion on how to obtain a similar result?
I need to control this option from another page in the panel. :pray:

You could use a workaround, though, using two blueprints and serve them depending on that value.

Maybe it’s even possible with an options block (The changeTemplate workflow - #2 by texnixe), so basically, you would provide this options block via a plugin depending on that options page setting.

Edit: I tested this last option and seems to work.

In blueprint:

options:
  extends: options/options

In plugin:

<?php
// for test purposes I use a field in site
if(site()->toggle()->toBool() === false) {
    $dir = __DIR__. '/blueprints/options/editorno.yml';
} else {
    $dir = __DIR__ . '/blueprints/options/editoryes.yml';
}
Kirby::plugin('superwoman/superplugin', [
    'blueprints' => [
        'options/options' => $dir
    ]
]);

editorno.yml

changeStatus:
  admin: yes
  editor: no

editoryes.yml

changeStatus:
  admin: yes
  editor: yes

Using the query language for this purpose would of course be more comfortable.

Ideas issue created: