? .git
? 297947_advcontact_configurable_msg.patch
? po
Index: advcontact.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advcontact/advcontact.module,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 advcontact.module
--- advcontact.module	27 Mar 2009 04:48:42 -0000	1.1.2.3
+++ advcontact.module	27 Mar 2009 06:06:21 -0000
@@ -28,6 +28,32 @@ function advcontact_help($section) {
  * This is where we modify the contact form to provide our new functionality.
  */
 function advcontact_form_alter($form_id, &$form) {
+
+	// Add some options to the contact settings form. Its a basic Drupal setting
+	// form so it will take care of storing these values for us.
+	drupal_set_message(variable_get('advcontact_replace_information', test));
+	if ($form_id == 'contact_admin_settings') {
+		$form['advcontact'] = array(
+			'#type' => 'fieldset',
+			'#title' => t('Advanced Contact Options'),
+			'#collapsible' => TRUE,
+			'#collapsed' => TRUE,
+			'#weight' => -1,
+		);
+		$form['advcontact']['advcontact_category_information'] = array(
+			'#type' => 'textarea',
+			'#title' => t('Advanced Contact additional information'),
+			'#description' => t('Provide additional information when a category is selected. You can use @category in you message and it will be replaced by the provided category.'),
+			'#default_value' => variable_get('advcontact_category_information', t('You can leave us a message using the contact form below regarding: @category')),
+		);
+		$form['advcontact']['advcontact_replace_information'] = array(
+			'#type' => 'checkbox',
+			'#title' => t('Replace Contact information'),
+			'#description' => t('If selected, the additional information provided will be used to replace the default contact information provided by the contact module. Otherwise it will be appended.'),
+			'#default_value' => variable_get('advcontact_replace_information', TRUE),
+		);
+	}
+
   if ($form_id == 'contact_mail_page') {
     if ($cat = $_GET['category']) {
       $cid = array_search($cat, $form['cid']['#options']);
@@ -37,8 +63,19 @@ function advcontact_form_alter($form_id,
           '#value' => $cid,
           '#required' => TRUE,
         );
-        $form['contact_information']['#value'] =
-          t('You can leave us a message using the contact form below regarding: @category', array('@category' => $cat));
+        $msg = filter_xss_admin(variable_get('advcontact_category_information', t('You can leave us a message using the contact form below regarding: @category')));
+        // We have to replace it manually for those users that manually input the value.
+        $msg = str_replace('@category', check_plain($cat), $msg);
+        if (variable_get('advcontact_replace_information', TRUE)) {
+	        $form['contact_information']['#value'] = $msg;
+        }
+        else {
+        
+	        $form['contact_information']['extra'] = array(
+	        	'#prefix' => ' ', // A space because it'll usually need it.
+	        	'#value' => $msg,
+	       	);
+        }
       }
     }
 
