function domain_locale_languages_overview_form_submit in Domain Locale 6
FormsAPI submit handler for domain language settings
File
- ./
domain_locale.admin.inc, line 108 - Provides admin functionality for domain specific language settings
Code
function domain_locale_languages_overview_form_submit($form, &$form_state) {
$domain_id = $form_state['values']['domain_id'];
$check = domain_locale_lookup($domain_id);
if (is_array($check) && count($check) >= 1) {
domain_locale_delete_domain($domain_id);
}
$languages = language_list();
$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;
$default = $form_state['values']['site_default'];
//Construct the array for inserts and updates. Looping over existing languages list.
$params = array();
foreach ($languages as $langcode => $language) {
//Workaround for disabled checkbox and not enabled languages
if (($default == $langcode || is_string($form_state['values']['enabled'][$langcode]) || $langcode == $domain_default) && $language->enabled == 1) {
$params[$langcode]['language'] = $langcode;
$params[$langcode]['weight'] = $form_state['values']['weight'][$langcode];
}
}
domain_locale_insert_domain($domain_id, $params);
//Update domain_conf language_default variable
domain_conf_variable_set($domain_id, 'language_default', $default);
// Changing the language settings impacts the interface.
cache_clear_all('*', 'cache_page', TRUE);
drupal_set_message(t('Updated domain specific language settings.'));
// Return to the correct page.
$form_state['redirect'] = 'admin/build/domain/language/' . $domain_id;
}