Description of the need
We have a handful of contrib projects that store API Keys or other sensitive data. Some of these store the data in settings, some in state, and some in config.
I think the safest way to handle secure data would be to store it in the database (via the state system) but since these values often need to be deployed across environments, it would also be nice to be able to define them in settings.php.
Proposed solution
To make lives easier for our contributors, we should provide a FormAPI element that could be used on a normal admin form, that would check both of these two locations for a value, with settings overriding the database if it was provided. When the form is saved, the newly-provided value gets entered into the state system (if it was not initially pulled form settings).
To make lives easier on our site architects/administrators, the Form element should appear like a normal text field, but automatically provide description text explaining that the value within will not be saved in configuration, but that it can be included in the settings.php file (and maybe provide the example code right there, as well).
The FormAPI element should also have a property #hidden_value (or similar) that would give the module developer a choice of whether the value stored should be revealed to the site architect/administrator or not. When this property is set to TRUE placeholder text should be added automatically that reads Value hidden for safety (or similar).
Alternatives that have been considered
TBD
Additional information
TBD
Draft of feature description for Press Release (1 paragraph at most)
Backdrop now includes a new FormAPI element that will help administrators keep sensitive data safe. This element will not save its value in configuration files, which are often committed into Version Control Systems, but instead will store it in the more secure state system (the database), or it can pull the value from settings.php.
Recent comments
Thanks @indigoxela! It works (at least as a start): Now I can use the filter... BUT: I get, as you predicted, a lot of duplicates (One node appears 7 times, other 5 times, other 3...
Parent items won't show on Leaflet Widget.
Thank you all for the quick help - or trying to. And I apologize for not properly documenting this seeming flaw in Backdrop. I was too eager to find a work-around (cannot have a non-...
Paypal button code gets messed-up
Yes Olaf, Works in most cases, but not with what was in the field originally (sorry, that is now deleted). I think it was very similar to this, and the paypal code was added at the...
Paypal button code gets messed-up