You are here

function admin_language_modify_language_element in Administration Language 6

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

#after_build callback which modifies the language select widget on the node add/edit form.

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

File

./admin_language.module, line 414
Makes sure all admin pages are displayed in the preferred language of the administrator.

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