I'm using many information data on my site. I have some blocks with the main informations like address and phone numbers, but also I have some blocks with Quick Response code, geolocations (latitude, longitude) etc. There is about 15 this kind of details.

I wrote a simple module which allows me to define them in one place and save all of them as a one variable (array), so if I need any contact detail in any block template file, I just call e.g: $contact_details['qr_code'] to get it.

It's working and it is very useful, but I'm just wondering what do you think about that? Maybe I spent couple hours unnecessarily, because this kind of module already exists, or maybe I did not need any module at all, because for example: I should create a page with as many fields as I need, and then create my blocks with views?

I think many people would be intersted where to store all their contact informations and use them to build any content they need, for example blocks.

there is a small cutting of my module output:

a form with site wide contact details

  • 1
    How about you upload your module to drupal.com? ;) I'd like to use it. – Turion Aug 4 '13 at 18:31
  • I think it's too simple for drupal.com :) but If you or anyone will want to take a look, then I can send it by email, no problem. – Jack-PL Aug 4 '13 at 21:26
  • 1
    Then put it on github :-) I might fork it and turn it into a module. – Turion Aug 6 '13 at 11:45

AFAIK, there is no module that does this for you.

I think this is a sensible approach. I am doing the same thing myself, storing the array with site-wide persistant data using the built-in function variable_set() to save, and then I use function variable_get() to retrieve the data.

I don't think saving site wide information in fields is a good idea.

|improve this answer|||||
  • Thanks for your opinion. That's why I wrote this module. I think it's very useful and I was very surprised when I can't find anything like that on drupal.org – Jack-PL Apr 25 '13 at 14:45

The is no a bad solutions, when they actually work for you.

My approach would be:

1.Create a node type with all types of fields needed.

2.Create one node of that type and fill out with data.

3.Create custom module, with several blocks returning field_view_value() of fields that node has.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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