/**
* Implements hook_form_alter.
* Client wants the subject field to initially be blank.
* If the user doesn't type in a subject line, then the
* node title should be inserted in the subject field.
* Currently in the code below, the form_alter puts the node title as the
* #default_value in the subject field.
*/
function external_page_form_alter($form_id, &$form) {
$site =
strtok($_SERVER['SERVER_NAME'],
'.');
switch ($form_id) {
case 'comment_form' :
if ($site == 'comments') {
$form['subject'] =
array (
'#type' => textfield,
'#title' => 'Subject',
);
}
break;
}
}
function external_page_comment_form_validate($form_id, $form_values) {
//Not validating anything just now.
}
function external_page_comment_form_submit($form, $form_values) {
/**
* Note: this code doesn't work, what happens is that if the subject field is blank
* then it somehow gets populated with the first part of the first sentence i of the
* text in the the comment field.
*/
if ($form_values['subject'] == '') {
$form_values['subject'] = $subject;
//form_set_value($form_values['subject'], $subject);
}
}