Posted by q0rban on August 27, 2009 at 5:59pm
| Project: | Strongarm |
| Version: | 6.x-1.0-beta3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
It would be nice if strongarm provided a hook for 'weakarm' variables. The hook would return an array of variables that act more as a set of initial defaults, and can always be overridden by a database value, unlike hook_strongarm which are enforced by default. Make sense?
Comments
#1
there's a nifty function that does this already - it's called variable_set
#2
So you don't see the value of having some default values for a feature or something that are automatically overridden if there is a value in the DB? Replaces this logic:
<?phpif (is_null(variable_get('some_var', NULL))) {
variable_set('some_var', '[insert default value here]');
}
?>
#3
Im keen to try the variable_set method in my feature but there may be an issue to solve first.
I want to add vars for logical defaults, but not have them erase any changes the user may have made since the last version of the feature was installed when they do an update of the feature.
Im sort of torn because I can be sure strongarm will track this and give the option to over-ride with notices... but I'm not sure all that is needed for setting pathauto & content_type tweaks that we only want an initial injection of.
Did you get any further with your idea q0rban?
#4
Starting work on this. Still needs lots of work but I wanted to post what I had here for when I pick it back up again. I think I may have to completely rewrite the structure of the var_conf cache in order for this to work though, as right now the form_alter disables form elements for all strongarm/weakarm vars, and we need it to only do it on strongarm vars.
#5
I think I like this idea better: #627924: Allow for strongarming specific key of arrayed variables
#6
Cool .. thanks for the link!