Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using variable_get('name-of-setting', 'default-value') to retrieve module/theme settings in several locations in code.

The purpose is to keep default settings in one locations preferable in .info file. I am able to this for themes:

variable_get('name-of-setting', theme_get_setting('name-of-setting'));

Here the theme_get_setting() retrieves the settings from the theme-name.info file:

settings['name-of-setting'] = some_value

Can i do the same for modules? What is the API to retrieve settings from module .info file? If not, how do you handle module default settings to avoid it scatter around code?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You're probably looking for drupal_parse_info_file()

Parses Drupal module and theme .info files.

Info files are NOT for placing arbitrary theme and module-specific settings. Use variable_get() and variable_set() for that.

Pay attention to the second paragraph - it applies to you :)

share|improve this answer
    
Thank You Clive –  latvian Apr 27 at 0:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.