You are here

function admin_language_form_alter in Administration Language 6

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

Implementation of hook_form_alter().

File

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

Code

function admin_language_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
    if (module_exists('translation') && variable_get('admin_language_hide_node', 0)) {
      if (isset($form['language'])) {

        // init #after_build if it doesn't exist
        if (!isset($form['#after_build'])) {
          $form['#after_build'] = array();
        }

        // add a callback for cleaning up the language select widget
        $form['#after_build'][] = 'admin_language_modify_language_element';
      }
    }
  }
}