[development] low hanging fruit for Drupal 6: variable defaults
Gabor Hojtsy
gabor at hojtsy.hu
Thu May 3 09:19:29 UTC 2007
Gerhard Killesreiter wrote:
>> Have fun with naming it hook_settings(), as far as I see, it is an
>> appropriate name, and not taken at the moment :) So Drupal can do a
>> module_invoke_all() on hook_settings() and collect defaults to all
>> variables from the modules defining them. It gets easier and shorter to
>> use variables:
>>
>> variable_get('my_fine_var');
>
> We should however keep an optional second argument. I don't always use
> the same second argument, and that's intentional.
Erm, what you do if the user saves his settings into the db, so you have
one fixed value to work with? The use case of alternate defaults for
variables is not clear to me. Bbut I have nothing against having that
supported if you show a good use case, although we would need to hammer
people to update their code to use hook_settings() as variable_get()
will work as is without modification in Drupal 6.
Gabor
More information about the development
mailing list