You are here

function talk_form_alter in Talk 7

Same name and namespace in other branches
  1. 5 talk.module \talk_form_alter()
  2. 6 talk.module \talk_form_alter()

Implements hook_form_alter().

File

./talk.module, line 239
Comments are displayed in a separate 'talk' tab, for node types you wish

Code

function talk_form_alter(&$form, $form_state, $form_id) {

  // Add option to comment options of node types.
  if ($form_id == 'node_type_form' && isset($form['#node_type'])) {
    $form['comment']['comment_talk'] = array(
      '#type' => 'checkbox',
      '#title' => t('Display comments on separate talk page'),
      '#prefix' => '<strong>' . t('Talk pages:') . '</strong>',
      '#weight' => 5,
      '#default_value' => talk_activated($form['#node_type']->type),
    );
  }
  if (isset($form['#node']->type) && talk_activated($form['#node']->type) && $form['#form_id'] == 'comment_node_' . $form['#node']->type . '_form') {
    $form['#submit'][] = 'talk_comment_hijack';
  }
}