On 5/3/07, Gabor Hojtsy <gabor@hojtsy.hu> wrote:
**We need a central place to define variable defaults**
Why can't that central place be the variable table? We could remove the second argument to variable_get and refactor some code to do the variable_set at install time which eliminates the need for the defaults in the variable_get() calls themselves. add1sun recently contributed a patch to pathauto that did this. The reason it's needed in pathauto was the use of variable_get's that involved variable variable names (e.g. variable_get('pathauto_'. $something .'..., '') which had empty defaults and the code did nothing if the variable came back empty. To make sure pathauto worked without submitting the settings page, it now sets variables in hook_install. Couldn't all modules do that? Then we eliminate the second argument to variable_get, create the centralized place to define variable defaults as you wanted, but need no new hooks and no new module_invoke_all and no new caching of "yet another variable system".
Don't care yet about how this fits into translatable variables, because we can only follow up on that if this gets done. So someone please grab this issue and run with it ;)
The tasks would be fairly simple: 1. Modify variable get to take one argument 2. Find all variable_gets and their corresponding default, move the default to an _install 3. Document it on the update/modules page 4. Rejoice 5. Console killes I'd be happy to run with that if people like the approach. Regards, Greg