You are here

function domain_locale_insert_domain in Domain Locale 7

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

Save language settings for a single domain

Parameters

int $domain_id:

array $params: Multidimensional array of language elements where language, weight and default are array keys.

2 calls to domain_locale_insert_domain()
domain_locale_form_submit in ./domain_locale.admin.inc
FormsAPI submit handler for domain language settings
drush_domain_locale_set in ./domain_locale.drush.inc
Add a language to a site.

File

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

Code

function domain_locale_insert_domain($domain_id, $params = array()) {
  foreach ($params as $setting) {

    // Setting must have at least language defined, weight and default can
    // have default values.
    if (isset($setting['language'])) {
      $setting['domain_id'] = $domain_id;
      drupal_write_record('domain_locale', $setting);
    }
  }

  // Make all languages enabled under the hood
  db_update('languages')
    ->fields(array(
    'enabled' => 1,
  ))
    ->execute();
}