pa4373
pa4373

Reputation: 33

Shared Values for multiple modules in Drupal 7

I'm using drupal 7 to build a website. What annoys me the most that it seems there're so much fields which shares the same value across multiple modules setting. For example, E-mail address for site e-mail, simplenews sender and etc.

I'm wondering whether there's a way to solve the situation just like what we do in programming - using variable, so we don't need to change the values each by each, to keep them all the same.

Thanks!

Upvotes: 0

Views: 44

Answers (1)

Sumoanand
Sumoanand

Reputation: 8929

Probably, you are looking for variable_set & variable_get drupal apis.

Example: Set the value like this:

variable_set('email_id', '[email protected]');

Then you can retrieve it in any module like following:

$email_id = variable_get('email_id');

Upvotes: 3

Related Questions