You are here

function locale_form_alter in Drupal 7

Same name and namespace in other branches
  1. 6 modules/locale/locale.module \locale_form_alter()

Implements hook_form_alter().

Adds language fields to user forms.

File

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

Code

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

  // Only alter user forms if there is more than one language.
  if (drupal_multilingual()) {

    // Display language selector when either creating a user on the admin
    // interface or editing a user account.
    if ($form_id == 'user_register_form' || $form_id == 'user_profile_form' && $form['#user_category'] == 'account') {
      locale_language_selector_form($form, $form_state, $form['#user']);
    }
  }
}