4

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

1 Answer 1

2

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.

3
  • 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.
    – devunder
    Commented Sep 25, 2012 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
    Commented Sep 25, 2012 at 22:24
  • That looks like what I need. Thanks...appreciated. The correct url drupal.org/project/variable
    – devunder
    Commented Sep 25, 2012 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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