i am wondering what would be the kirby ideomatic approach for site wide settings. Here is my situation:
- there are admins and non-admins
- admins see an admin-tab on site.yml
- non-admins see a reduced site blueprint (whithout the admin-tab)
- on the adminin tab there are some feature-toggles, e.g. “should_see_info”
- on non-admin site blueprint an info-section has a when property and shall only show the section if an admin turns on “should_see_inf” which is a toggle field
Although the field got written to the site content file the when property doesn’t seem to work for non-admins.
My assumption is, that content fields are only accessible if the site blueprint contains the field (which is in my case not true for non-admins). If that assumption is true, what would be the correct way to configure such settings as admin for non-admins.
Thanks in advance for any help,
Hm, yes, might be that the data is not loaded in that case. What you could do instead is make those settings fields hidden rather than not have them in the blueprint for your non-admins at all (via programmable blueprint settings for those fields)
thanks for your quick reply!
I also thought about dedicating a page for such settings which is not be accessible through non-admins. Would that be cleaner solution? In a future version of our backend we’d like to provide such settings through something like a dedicated Admin-Kirby wich serves as “settings-backend”.
Maybe, you would have to make sure to hide that page in the frontend though. Why not use those hidden fields?
Yes, a dedicated admin area for such settings would be nice, but then the question would be where those settings would ideally be stored, maybe not even in a page but some json files or so.
i thought of a page because kirby comes with everything to edit the page from the panel … a json file is more a developer thing to edited through CLI …
Not necessarily: Advanced Panel area | Kirby CMS, but requires some coding.
With the page, you are done quickly. Only set up a route to hide it from frontend.
hmm … hidden fields and
when option doesn’t seem to be compatible. The info section which is being shown as long as the field is of type
toggleas soon i change to
hiddenthe section disappears.
I think the problem with the toggle is that it automatically evaluates to a boolean, whereas the hidden field returns a string.
oh yes, that exactly was the problem. Changing
when condition to
false did the trick. Thanks @texnixe !