function locale_form_comment_form_alter

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

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);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!locale!locale.module/function/locale_form_comment_form_alter/7.x