Prevent site fields from saving

Hello, everyone.

I’m looking for a solution to do not save certain site fields in the TXT files and only to call them using a hook. I’ve already tried to do this with the “site.update:before” hook, but I’m missing a way of finding out certain fields there. Does somebody has any idea? I want to build a workaround to save some field data inside the site configuration programmatically.

Can anyone help?

Could you elaborate a bit more what you are trying to achieve here. I understand the part about not wanting to save a particular value, but not what you want to do with this value instead.

Since there is no such thing as a site model, you would have to extend the kirby and site classes and then overwrite the writeContent() method. But maybe there is a better way to achieve what you are looking for.

Shure, of course. I want to find a way to programmatically generate the config.php via a custom plugin. Therefore I want to build a section inside the sites panel with all input fields, but I don’t want to save them inside the site.txt, because I just want to parse them and create a config.php file programmatically.

Or is there a better way to programmatically set config settings like ‘auth’ or ‘panel’ via a Plugin?

I certainly wouldn’t parse the config, but if anything, then use an .env file that is then read from the config.

Also, I wonder if this should happen in the site which is after all accessible to all users. Maybe better create a custom Panel area, then you wouldn’t have the problem of having to create a custom site class to not store the content and more control over permissions.

And I’d be careful with the sort of settings you want to make configurable via user input (thinking about users changing the slug on the fly or something like that).