Allow null as option default value
Currently, if you set an option default value to null in your config/option.php file, every time you activate the plugin the value of that option is deleted, whatever the current value is.
@ManuDoni currently you can delete an option using
$plugin->options->set( 'General.option_1', null );
So this request wouldn't work. Could you describe in what scenario it would be useful to receive a null option?
My use case was this: I had an option that contained an oauth2 token. In my config I had something like this:
[
"ms-graph-api": [
"client_id": "",
"client_secret": "",
"token": null,
]
]
The token, when present, is an array that contains the expiry, the access token and the refresh token. With the current version the token is deleted every time I deactivate the plugin because of the null default value.
I don't mind if you want to delete this PR, I don't need this anymore because we abandoned the project we built on top of this nice little framework.
I believe this PR would be a breaking change but maybe the fact that a null default value has this side effect should be in the documentation.
@ManuDoni To participate more actively in discussions and stay updated on proposals and latest releases, I would be pleased if you joined the WP Bones community on Discord.