You are here

function domain_locale_restore_default in Domain Locale 7

Same name and namespace in other branches
  1. 6 domain_locale.module \domain_locale_restore_default()

Reset Domain Locale settings to site language settings.

Parameters

int $domain_id:

2 calls to domain_locale_restore_default()
domain_locale_domain_insert in ./domain_locale.module
Implements hook_domain_insert().
domain_locale_reset_form_submit in ./domain_locale.admin.inc
FormsAPI for domain_locale_reset_form.

File

./domain_locale.module, line 475
Provides domain specific language settings.

Code

function domain_locale_restore_default($domain_id) {
  $enabled_languages = db_query('SELECT language, weight FROM {languages} WHERE enabled = 1');
  db_delete('domain_locale')
    ->condition('domain_id', $domain_id)
    ->execute();
  foreach ($enabled_languages as $lang) {
    db_insert('domain_locale')
      ->fields(array(
      'language' => $lang->language,
      'domain_id' => $domain_id,
      'weight' => $lang->weight,
    ))
      ->execute();
  }
}