"Variables" is the term used in Drupal for persistent variables, which are the variables set with variable_set().
4
votes
1answer
42 views
Where in the database does fieldset and field instance info live?
Background: I'm writing a module that will hopefully make reverse-engineering specs for site audits easier. (If you're interested, you can see the Topograph module-in-progress on my Github account.)
...
2
votes
3answers
67 views
Where do you store arbitrary home page data?
There's some welcome heading, text, video that goes on the front page. Currently this is stored in variables but it feels wrong to me because, well, it's a wall of text and variables is loaded on ...
0
votes
1answer
15 views
Where should I define the “drupal_stale_file_threshold” Drupal variable?
I want to delete my CSS and JavaScript files every day. Where do I define the "drupal_stale_file_threshold" variable?
In the template.php file with variable_set('drupal_stale_file_threshold', ...
0
votes
1answer
14 views
how to make config fields stick at admin/structure/types/manage/<content_type>?
I am adding a config option to all content types. I have textfield and checkbox now.
How to SAVE what I write in the textfield and state of checkbox when I hit submit?? Do I need to alter submit ...
0
votes
2answers
73 views
Persistent session cookies: remember session even after closing the browser
I would like to store anonymous users $_SESSION in a cookie so that their cart and other custom information is still available even after closing the browser.
I found this interesting post which ...
0
votes
1answer
29 views
Global Variable with a dynamic value set by variable_get() in multisite
My question is, if I have a multisite environment what is the expected behaviour of global variables set like:
define('GLOBAL_VARIABLE' , variable_get('myvar'));
'myvar' is set in a module ...
1
vote
2answers
74 views
The best way to store drupal Configuration
I know three options to store the configurations:
Use the UI and store the values into the variable table.
Also you can store them in settings.php and use the $conf[''] array to store the ...
2
votes
2answers
85 views
Multi-site variables table for shared variables (extending variable_set)
I have a multi-site setup with some shared tables using db_prefix. The variables table is NOT shared. Sharing ALL variables would cause lot of trouble, but sharing only some selected variables wont.
...
1
vote
2answers
65 views
Define multiple variables in a custom module using hook_variable_info()
Im using the Variable module and need to define a variable with the type "multiple" in my custom module. I've been googled whole my day searching for any documentation or just an example and haven't ...
0
votes
0answers
7 views
How to programatically update time offset in a Featurized Rule?
I have a rule that compares the value of a date field to the current date. I also have a custom module with a config form that allows the user to set a number of hours of time offset. The rule is ...
0
votes
1answer
36 views
How to write options lists with drush vset?
When we want to pin a variable for an environment, we'll set the value in the admin, then go look it up in the database, and copy the name and value into a bash or phing script, to insure that that ...
0
votes
0answers
11 views
Variable and domain_variable have stuffed up my menus
Variable and domain_variable modules fixed the front page issue, so I am now able to have two unique front pages. However, it has broken the main menus. I've had the original Main Menu displaying on ...
3
votes
4answers
229 views
How do I set variables for variable_get()?
I am trying to understand variable_get(). I read so far that you can set variables in the settings.php using the $conf array and retrieve them later in code by using variable_get(). I have read that ...
2
votes
1answer
21 views
Is there a variable that keeps track of which pages are enabled or disabled in Page Manager?
I'm using the Features module and I'm tired of manually enabling/disabling pages (user_edit, user_view, etc.) Is there a variable that I can add to Strongarm to control this in code?
2
votes
2answers
45 views
Site wide information data
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, ...
2
votes
2answers
98 views
Trying to make a custom region disappear upon user login, then reappear when user logs out
I've looked everywhere for an answer to my problem, but can't find one. My goal is to collapse/force a custom region on my website to disappear when a user logs in, and then have it reappear when the ...
3
votes
1answer
61 views
Conflict with db_set_active and variable_get
I am running a drupal multi-site system, with shared code and seperated DB. Each individual multi-site represents one continent and can have different language versions.
What i want:
I am working on ...
0
votes
2answers
54 views
D6 - Trying to display variable_get()s in a block
I am trying to display 4 variables in a custom block(created from my custom module). I am accessing the variables using variable_get('$myvariable', '0').
I am not able to display the array in the ...
0
votes
3answers
98 views
Unable to save variable(s) from a custom form
I want to create a custom form with a few textfields and then use variable_set to save those textfields as variables.
I am not able to save the variable with the code below.
Question: I do not see ...
0
votes
1answer
44 views
Unable to set and display variable in theme
I've got the following snippet in my template.php file, using Drupal 7:
function mytheme_preprocess_page() {
global $variables;
$variables['user_full_name'] = "Joe Soap";
}
and trying to ...
1
vote
1answer
286 views
Correct way of passing variables between hook and tpl.php
I asked a similar question a few months ago, but the truth is that there is very little information about the correct way of doing this.
The simplest way is to use the arg() function, but as the docs ...
0
votes
1answer
96 views
Can you display a variable in a Drupal webform component label?
I'm trying to create a webform in Drupal 6 where the label of a select webform component is rendered using the contents of a variable. For example:
client_name = "Starbucks"
and I would like the ...
4
votes
1answer
109 views
Get site_name without html
I've got a custom module that is sending some emails and I want to put the site name in the subject line, but whenever I look up the site_name in code, it is wrapped in html.
This is the code I use ...
0
votes
1answer
15 views
Is there anything like attached data storage for a view?
I'm having hard time using Views with i18n Views. What gets me very irritated is that the translations of global fields (headers, footers, etc.) get lost whenever I make changes to that View. I would ...
0
votes
3answers
133 views
How to pass variables between theme functions
I often use functions that contain variables in the following files:
Template.php
Custom Panels Style Plugins
node.tpl.php files
field.tpl.php files
views.tpl.php files
I often needed to pass ...
0
votes
0answers
70 views
Fatal Error: Undefined function variable_get();
I have this, $metrics = variable_get('rbi_metrics_list_settings',array());, I have used this in 3-4 pages. And when I put in another file, when I wanted to see what's inside of $metrics , it said ...
0
votes
1answer
286 views
Only variables should be passed by reference in faq_ask_node_insert() [closed]
I get this strict warning when I ask a question in faq_ask module: Strict warning: Only variables should be passed by reference in faq_ask_node_insert(). The PHP file is faq_ask module and the path to ...
0
votes
0answers
48 views
Drupal 7 looking for css_js_query_string as url?
When I load user pages (but not admin pages), I'm getting a 404 at http://site.com/&mcnqv4. When I search the database, it finds one match of that string, which is the variable table -> ...
1
vote
1answer
68 views
What's overriding my local_settings.php?
I'm using a local_settings.php file, that includes several $conf settings. All of the settings were working as expected until just recently when the mail_system setting started getting overridden ...
1
vote
1answer
53 views
variable_get with prefix
It's there a chance to retrieve all key/value, stored in variable table, that have a prefix, using variable_get()?
e.g: variable_get("prefix_*")
Or I have to use db_select('variable')?
2
votes
3answers
192 views
From where does variable_get() get the first parameter?
function variable_get($name, $default = NULL) {
global $conf;
return isset($conf[$name]) ? $conf[$name] : $default;
}
From where does variable_get() get the first parameter?
2
votes
1answer
130 views
Global site variables to be used in node fields and menu item
I'm looking for some way of having variable defined by admin which can be displayed in some fields or nodes.
Real use case:
I have that specific date that changes periodically. And I want it to ...
0
votes
1answer
280 views
Variable_get question default value in form
So I am reading Drupal Development Pro 7 and have stumbled upon something I am a little bit unsure about to do with the variable_get function & form element. I understand it retrieves a stored ...
0
votes
0answers
192 views
How do I free a variable set using variable_set()?
I have used variable_get(), and variable_set() in my form search, but when I visit another page, and come to the module again, it shows the previous results. How can I free the variable at the time of ...
3
votes
2answers
854 views
How to add variables to $conf array?
To modify some default settings for the Feeds module, I need to set a variable in the $conf array. What is the right way to achieve this?
I've tried adding it in the settings.php file (currently on ...
0
votes
1answer
263 views
In a custom module, what is the most elegant way to pass variables between functions?
** I have updated this post with my solution to the problem. See at the bottom of this post. **
I am writing a custom ajax contact module. It's fairly simple at this point, doesn't have any sort of ...
0
votes
1answer
428 views
variable_get/set not working right
I am using drupal 6. I have a variable in a function which I saved with variable_set. I called variable_get in a different function and it keeps giving me the default. Why wont it save the variable? I ...
0
votes
1answer
284 views
Why do I have to add main-menu under features[] in the theme info file?
I have seen other themes that just define regions and then use drupals theme() function in the page.tpl.php to print the Main menu wherever the developer pleases.
This was not the case for me, and I ...
0
votes
1answer
207 views
how to set a variable in module and get it in theme
i want set a variable in module and use it in my theme,
(except variable_set and variable_get way.)
for instance . in module file
if(in_array(arg(1),$ex))
{
// set a variable
...
2
votes
1answer
248 views
Form API + Module: Nested default value variable_get doesnt behave the same as unnested variable_get
Heres the example code:
function mymodule_form($form, &$form_state){
$form['nest'] = array(
'#type' => 'fieldset',
'#title' => t('Nested settings'),
'#tree' ...
1
vote
3answers
701 views
How does Drupal find contributed modules and themes?
I have a development site with a peculiar problem Although the contributed modules and themes are in their proper place under sites/all/modules (& themes) I am getting an error message that says ...
2
votes
3answers
193 views
Default value to drupal variable
I have a piece of code that I want to have the default value be a variable, but I need to know how to set a default value if the variable is not set:
$form['background_audio_height'] = array(
...
0
votes
2answers
100 views
Custom Page type and variables
In my preprocess_page() function, I'm setting variables based on the user that is logged in.
I created a custom page that is used as a Welcome page with the information about the user that I set in ...
2
votes
2answers
47 views
How can I get documentation on a variable listed in the Features UI provided by Strongarm?
When looking through the list of variables provided by Strongarm, there are several that sound like they might be useful to include but what they actually refer to is impossible to guess from the name ...
2
votes
1answer
261 views
How to optimize the unserialization of “variables” cache value
As we all know, the whole variable table is being cached in the drupal cache system and is being extracted into global $conf variable in each invoke. In one of our production site with the domain ...
1
vote
1answer
429 views
File Upload form issue
I have been working on this code and I am having some errors, and I was wondering if anybody can find errors in this code... I have posted my error below it...
function background_audio_form($form, ...
1
vote
1answer
60 views
Form Submit Issue
Below is my form submit statement for my site. I know that the query works by it self however it does not seem to be setting the variable correctly. Does anybody see why this would not work, or am I ...
1
vote
2answers
224 views
db_query to drupal variable
I have a the following query:
function background_audio_file_query($path) {
$result = db_query("SELECT uri
FROM `file_managed`
WHERE `filemime` = 'audio/mpeg'
LIMIT 1 , 30",
...
2
votes
2answers
1k views
Using variable_get() in multiple places, without duplicating $default
When using variable_get() in multiple places, how should one avoid duplicating the $default values?
define()? Or is there some built-in Drupal-specific mechanism I'm missing?
1
vote
1answer
206 views
Why doesn't variable_set() work in an installation profile?
I'm writing an installation profile, and I want to display some forms on some pages. The form below intended to set a variable at submission time. It does not work in the profile, but it works on an ...