oddhill / odddrupal

Complete Drupal package that contains our custom installation profiles.
www.oddhill.se
1 stars 1 forks source link

Administration Language module shouldn't be enabled by default #22

Closed mohamedalioh closed 8 years ago

mohamedalioh commented 8 years ago

This a suggestion not to make Administration Language module enabled by default in odddrupal profile, as it cause an error in the user edit page if there are not other languages enabled rather than English:

Warning: Invalid argument supplied for foreach() in element_children() (line 6568 of /public/includes/common.inc).

because of this function:

/**
 * After build callback which removes the administration language from the list
 * of available languages on the user profile form.
 */
function _admin_language_user_form_remove_admin_language($form) {
  $admin_language = variable_get('admin_language_default', 'en');

  // remove the admin language from the available options
  unset($form['locale']['language'][$admin_language]);

  // at this point, the element has been expanded, so we grab all child elements
  $languages = element_children($form['locale']['language']);

  // make sure that the default value is available on the form
  $default_value = $form['locale']['language']['#default_value'];
  if (!isset($form['locale']['language'][$default_value])) {
    if (!empty($languages)) {
      $default_language = $languages[0];
      foreach ($languages as $language) {
        $form['locale']['language'][$language]['#value'] = $default_language;
      }
    }
  }

And also it doesn't make sense to have it enable until one wanted to add another language to the site.

olofbokedal commented 8 years ago

My initial thought when reading this was to fix the bug, but...

And also it doesn't make sense to have it enable until one wanted to add another language to the site.

You're damn right! We'll remove it :)