You are here

function locale_form_comment_form_alter in Drupal 7

Implements hook_form_FORM_ID_alter().

File

modules/locale/locale.module, line 400
Add language handling functionality and enables the translation of the user interface to languages other than English.

Code

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

  // If a content type has multilingual support we set the content language as
  // comment language.
  if ($form['language']['#value'] == LANGUAGE_NONE && locale_multilingual_node_type($form['#node']->type)) {
    global $language_content;
    $form['language']['#value'] = $language_content->language;
    $submit_callback = 'locale_field_comment_form_submit';
    array_unshift($form['actions']['preview']['#submit'], $submit_callback);
    array_unshift($form['#submit'], $submit_callback);
  }
}