Within a form build in a custom module trough the form api I'm using pieces of text (eula, help, hints) of which some of them need to be editable by my client (editor role).

For example:

$form['eula'] = array(
  '#type' => 'radios',
  '#title' => t('This text need to be editable. I agree to be bound by bla bla bla.'),
  '#options' => array('Ja'=>'Ja / Yes'),
  '#required' => TRUE,
);

I want to facilitate a central point where those text strings (like #title) can be edited and a way I can retrieve them in this custom module.

What's best practice for this scenario to do so? Create a content type for this or perhaps use variable_set/get?

Basically I want one location where my client can edit all those text strings. To use a content type for this and node_load() everytime feels a bit too much.

Thanks in advance

up vote 2 down vote accepted

As long as the string or text is passed via t() function you can override it using String Overrides module. Here is a quote from module's project page:

Provides a quick and easy way to replace any text on the site.

UPDATE

You can also use Variable module. Quote from project page:

... provides a registry for meta-data about Drupal variables and some extended Variable API and administration interface.

This is an API module so it must be installed only when other modules require it.

  • Thanks for your answer, I'm aware of that module and it's great. But since I'm also overriding some other strings there myself it get's cluttered pretty fast. I really want a single page (location) where only the strings are shown the client needs to edit. – undersound Sep 25 '12 at 22:21
  • Then in that case you will have to go the custom way and use the variable module drupal.org/project/variable.check it out. – junedkazi Sep 25 '12 at 22:24
  • That looks like what I need. Thanks...appreciated. The correct url drupal.org/project/variable – undersound Sep 25 '12 at 22:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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