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:
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
]
]);