You are here

function domain_locale_languages_overview_form in Domain Locale 6

A modified version of locale_languages_overview_form to manage domain language settings.

Parameters

string $type:

int $domain_id:

1 string reference to 'domain_locale_languages_overview_form'
domain_locale_page in ./domain_locale.admin.inc
The domain language page callback router.

File

./domain_locale.admin.inc, line 34
Provides admin functionality for domain specific language settings

Code

function domain_locale_languages_overview_form($type = 'all', $domain_id) {
  $languages = language_list('language', TRUE);
  $domain_languages = domain_locale_lookup($domain_id);
  $default_domain_language = domain_conf_variable_get($domain_id, 'language_default');
  $default_install_language = language_default('language');
  $domain_default = isset($default_domain_language) ? $default_domain_language : $default_install_language->language;
  $options = array();
  $form['domain_id'] = array(
    '#type' => 'value',
    '#value' => $domain_id,
  );
  $form['weight'] = array(
    '#tree' => TRUE,
  );
  foreach ($languages as $langcode => $language) {

    // Only show enabled languages
    if ($language->enabled == 1) {
      $options[$langcode] = '';
      if (isset($domain_languages[$langcode]) && $language->enabled == 1) {
        $enabled[] = $langcode;
      }
      $form['weight'][$langcode] = array(
        '#type' => 'weight',
        '#default_value' => $domain_languages[$langcode]['weight'],
      );
      $form['name'][$langcode] = array(
        '#value' => check_plain($language->name),
      );
      $form['native'][$langcode] = array(
        '#value' => check_plain($language->native),
      );
    }
  }
  $form['enabled'] = array(
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => $enabled,
  );
  $form['site_default'] = array(
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => $domain_default,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['#theme'] = 'domain_locale_languages_overview_form';
  return $form;
}