You are here

function domain_locale_get_domain_languages in Domain Locale 7

Helper function to retrieve list of languages available as form options

It is useful, for example, on node edit to limit number of language options.

Return value

Array language names indexed by language code. This array does not include 'und' (LANGUAGE_NONE).

See also

domain_locale_form_node_form_alter()

1 call to domain_locale_get_domain_languages()
_domain_locale_form_node_form_alter in ./domain_locale.module
Implements hook_form_BASE_FORM_ID_alter(). Called by domain_locale_form_node_form_alter

File

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

Code

function domain_locale_get_domain_languages() {
  global $_domain;
  $sql = <<<SQL
    SELECT
      dl.language,
      l.native
    FROM {domain_locale} dl
      INNER JOIN {languages} l ON dl.language = l.language
    WHERE domain_id = :domain_id
    ORDER BY dl.weight, language ASC
SQL;
  $result = db_query($sql, array(
    ':domain_id' => $_domain['domain_id'],
  ));

  // Fetch results as an array 'language code' => 'native'.
  $languages = $result
    ->fetchAllKeyed(0, 1);
  return $languages;
}