$categories_data['category'])));
$form['contact_information'] = array(
'#type' => 'markup',
'#value' => t((!$categories_data['page_info'] ? variable_get('contactforms_information' , 'You can send !category a message using the contact form below.') : $categories_data['page_info']) , array('!category' => $categories_data['category'])),
);
$subject = str_replace( array('-','_') , ' ' , arg(2));
$form['subject'] = array('#type' => 'textfield',
'#title' => t('Subject'),
'#maxlength' => 255,
'#default_value' => $subject,
'#required' => TRUE,
);
$form['cid'] = array(
'#type' => 'hidden',
'#value' => $categories_data['cid'],
'#required' => TRUE,
);
}
//Alter the contact Category Forms
if($form_id == 'contact_admin_edit'){
$cid = $form['cid']['#value'];
if ($cid) {
$contact = db_fetch_object(db_query('SELECT * FROM {contact} WHERE cid = %d', $cid));
}
//Adds a text area that will hold category specific info for the contact page information
$form['page_info'] = array(
'#type' => 'textarea',
'#title' => t('Additional Information'),
'#weight' => 0,
'#default_value' => $contact->page_info,
'#description' => t('Information to show on the individual contact page. If this is left empty the "Default Additional Information" will be displayed'),
);
//Set the weight of the category name so It appears above our inserted info area
$form['category']['#weight']='-1';
}
// Alter contact settings form
if ($form_id == 'contact_admin_settings') {
// get example contact form path
$query = db_fetch_object(db_query("SELECT * FROM {contact} LIMIT 1"));
$name = str_replace(' ', '_' ,$query->category);
$form['contact_form_information'] = array(
'#type' => 'textarea',
'#title' => t('Standard Contact Form Additional Information'),
'#weight' => -1,
'#default_value' => variable_get('contact_form_information', t('You can leave a message using the contact form below.')),
'#description' => t('Information to show on the standard contact page which has the path of /contact. Can be anything from submission guidelines to your postal address or telephone number.', array('@form' => url('contact'))),
);
$form['contactforms_information'] = array(
'#type' => 'textarea',
'#title' => t('Default Additional Information for the individual contact pages'),
'#weight' => 0,
'#default_value' => variable_get('contactforms_information', t('You can send !category a message using the contact form below.')),
'#description' => t('If a category doesn\'t have additional information specified this will be shown. To place the category name in your message use the wildcard "!category" e.g. You can send !category a message using the contact form below.', array('@form' => url('contact/'.$name))),
);
$form['contactform_redirect'] = array(
'#type' => 'textfield',
'#title' => t('Contact Form redirect'),
'#default_value' => variable_get('contactform_redirect', 'contact'),
'#weight' => -2,
'#maxlength' => 60,
'#description' => t('The page you would like to redirect to if a contact/category path is entered that doesn\'t exist.'),
'#required' => false,
);
$form['contactform_title'] = array(
'#type' => 'textfield',
'#title' => t('Contact Form Title'),
'#default_value' => variable_get('contactform_title', 'Contact !category'),
'#weight' => -3,
'#maxlength' => 60,
'#description' => t('The title you would like displayed on the contact page. To place the category name in the title use the wildcard "!category".', array('!form' => url('contact/'.$name))),
'#required' => true,
);
}
}
/**
* Implementation of hook_menu_alter
*/
function contact_forms_menu_alter(&$items) {
$items['contact/%'] = $items['contact'];
}
/**
* Implementation of hook_schema_alter
*/
function contact_forms_schema_alter(&$schema) {
// Add field to existing schema.
$schema['contact']['fields']['page_info'] = array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'Category Page Information Displayed on the individual category pages',
);
}