I'm using the following code in template.php:

function sdr_form_system_site_information_settings_alter(&$form, &$form_state)	{
	$form['phone_number'] = array(
		'#type' => 'textfield',
		'#title' => t('Phone Number'),
		'#description' => t('Appears in the website footer'),
		'#default_value' => variable_get('phone_number', ''),
	);
}

(sdr is the theme name)

That should, I think, insert a single field labeled as 'Phone Number' into the form in admin/config/system/site-information - except literally nothing is showing up. I've cleared the caches.

Can anyone help?

Thank you.

Edit - Oh, right. I'm using a different administration theme, so that's not going to work. So what should I use to achieve this?

Edit 2 - So I've created a module and added the fields in with that, using the same code. They are showing up, which is good! Can anyone give me some idea of how to get the data from them and assign to a variable?

Comments

Risotto’s picture

Following on from my two edits, I've come up with this which I'm using in the footer of my theme:
<?php echo $conf['phone_number'] ?>

It works. But is it bad practice? Anything wrong with doing it this way? I Googled and couldn't seem to find anyone using similar code...