You are here

function admin_language_modify_language_element in Administration Language 7

Same name and namespace in other branches
  1. 6 admin_language.module \admin_language_modify_language_element()

Callback for #after_build to modify add/edit form language select widget.

1 string reference to 'admin_language_modify_language_element'
admin_language_form_alter in ./admin_language.module
Implements hook_form_alter().

File

./admin_language.module, line 544
Makes admin pages be displayed in the administrator's preferred language.

Code

function admin_language_modify_language_element($form, &$form_state) {
  if (!user_access('use all enabled languages')) {

    // Remove the administration language from the list of available languages.
    if (isset($form['language']['#options']) && count($form['language']['#options']) > 2) {
      $language = variable_get('admin_language_default', 'en');
      unset($form['language']['#options'][$language]);
    }

    // Hide the language selector if we're forcing a default language.
    if (isset($form['language']) && variable_get('admin_language_force_default', 0)) {
      $form['language']['#access'] = FALSE;
    }
  }
  return $form;
}