Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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 '14 at 0:17

Your Answer


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.