is_numeric
is_numeric

Reputation: 187

Drupal 7 - How to edit a value stored in variable table

I have inherited a multi-site in Drupal 7. There is a page where the client needs to edit the title element but this page is not a content type, a block or a taxonomy item!? I have queried the db and found only one instance of the value which needs to be changed. It is stored in the Variable table. If I change the value here the value changes as expected on the site. Can anyone shed any light on where the administration page is likely to be for this value based on the location of the value? I guess this could be defined anywhere really but was hoping someone may have come across this before.

Upvotes: 1

Views: 5649

Answers (2)

Ajit S
Ajit S

Reputation: 1341

The values of variables in Drupal can be set in a couple of ways:

  1. From code - Using variable_set() function.
    Look in the code if anywhere this function is called to set the value of the variable. If this is the case, you can implement your own module with some configuration form to override the value of the variable.
  2. From a form defined using the Form API - Using system_settings_form() function.
    I'll suggest you to look for the name of the variable who's value is used to set the page title, and then search in the code if there is a form element by that name, which is returned using system_settings_form. Then find out where this form is rendered - might be at some menu. After which you can change the value of this variable from the form itself.

Upvotes: 0

Muhammad Reda
Muhammad Reda

Reputation: 27043

You can change any variable value by using variable_set.

// Example
variable_set('variable_name', 'value to save');

Another way is to use devel module. After enabling the module; Go to ?q=devel/variable, find the variable you need to change from the table and click on Edit next to it.

Upvotes: 6

Related Questions