category); $items[] = array( 'path' => 'contact/'. $name, 'access' => TRUE, 'type' => MENU_CALLBACK, ); } } } return $items; }*/ /** * Implementation of hook_form_alter() */ function contact_forms_form_alter($form_id, &$form) { $path = $_GET['q']; // check and disable contact_list.module if ( module_exists('contact_forms') && module_exists('contact_list')) { module_disable( array('contact_list')); } // redirect contact if another fall back page is defined if ($path == 'contact' && variable_get('contactform_redirect', 'contact') != 'contact') { drupal_goto(variable_get('contactform_redirect', 'contact')); } // Alter all contact forms except for /contact if ($form_id == 'contact_mail_page' && $path != 'contact') { $category = str_replace( '_' , ' ' , arg(1)); $query = db_query("SELECT * FROM {contact} WHERE category = '%s'", $category); //if category doesn't exist redirect to 'contact' or User Defined Page if (!db_num_rows($query)) { drupal_goto(variable_get('contactform_redirect', 'contact')); } $categories_data = db_fetch_array($query); //$contact_form_var = variable_get('contactform_title', 'contact !category'); drupal_set_title(t(variable_get('contactform_title', 'Contact !category'), array('!category' => $categories_data['category']))); $form['contact_information'] = array( '#type' => 'markup', '#value' => t(variable_get('contactforms_information' , 'You can send !category a message using the contact form below.') , array('!category' => $categories_data['category'])), ); $subject = str_replace( '_' , ' ' , 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 contact settings form if ($form_id == 'contact_admin_settings') { if (drupal_get_path('module', 'contact_list') != ''){ $contact_list_path = drupal_get_path('module', 'contact_list'); drupal_set_message('WARNING: You have both the Contact Forms and Contact List modules installed. The Contact Forms module replaces the Contact List module and has disabled it. Please delete the following folder.