Greg Knaddison - GVS wrote:
On 5/3/07, Dries Buytaert <dries.buytaert@gmail.com> wrote:
On 03 May 2007, at 21:43, Peter Wolanin wrote:
I don't think the suggestion below makes sense (setting variable defaults via hook_install), at least if we assume that the way to reset a module setting is to delete the corresponding variable.
Setting a variable on hook_install sounds clumsy, especially when we have /dynamic/ variables of the form:
variable_get($node->type ."_something", ...)
You simply don't know at install time, what variables might become available later on ...
But isn't that true whether it's in hook_install or in hook_settings or in the define mechanism that you proposed?
A hook_settings() runs at runtime (but invoked very rarely, see my last post to Ernie). A hook_settings() can grab a list of node types and return variable names based on node types.
I don't have an answer to Peter's point about resetting to defaults so I agree the approach is half baked and should probably be abandoned.
Why wouldn't you be able to remove certain variables from the DB, thus resorting to the values returned by hook_settings()? Resetting could work fine. Gabor