domain_lang.admin.inc in Domain Lang 7
Domain Language detection and selection administration pages.
File
domain_lang.admin.incView source
<?php
/**
* @file
* Domain Language detection and selection administration pages.
*/
/**
* Domain language detection and selection page form callback.
*/
function domain_lang_detection_selection_form($form, $form_state, $domain) {
// Redirect user to related domain because only on it
// will be loaded proper variables by domain_conf module.
$current_domain = domain_get_domain();
if ($current_domain['domain_id'] !== $domain['domain_id']) {
domain_goto($domain);
}
module_load_include('inc', 'locale', 'locale.admin');
$form = locale_languages_configure_form();
$form['#submit'] = array(
'domain_lang_detection_selection_form_submit',
);
$form['domain_id'] = array(
'#type' => 'value',
'#value' => $domain['domain_id'],
);
return $form;
}
/**
* Domain language detection and selection form submit callback.
*/
function domain_lang_detection_selection_form_submit($form, &$form_state) {
$domain_id = (int) $form_state['values']['domain_id'];
$configurable_types = $form['#language_types'];
foreach ($configurable_types as $type) {
$negotiation = array();
$enabled_providers = $form_state['values'][$type]['enabled'];
$enabled_providers[LANGUAGE_NEGOTIATION_DEFAULT] = TRUE;
$providers_weight = $form_state['values'][$type]['weight'];
foreach ($providers_weight as $id => $weight) {
if ($enabled_providers[$id]) {
$provider = $form[$type]['#language_providers'][$id];
$provider['weight'] = $weight;
$negotiation[$id] = $provider;
}
}
domain_lang_negotiation_set($domain_id, $type, $negotiation);
domain_conf_variable_set($domain_id, "locale_language_providers_weight_{$type}", $providers_weight);
}
// Update non-configurable language types and the related language negotiation
// configuration.
domain_lang_types_set($domain_id);
drupal_set_message(t('Language negotiation configuration saved.'));
}
Functions
Name | Description |
---|---|
domain_lang_detection_selection_form | Domain language detection and selection page form callback. |
domain_lang_detection_selection_form_submit | Domain language detection and selection form submit callback. |