domain_domains

Definition

domain_domains($reset = FALSE)
domain.module, line 467

Description

Return all active domains (including the default) as an array.

Parameters

$reset A boolean flag indicating whether to reset the static array or not.

Return value

An array of all active domains, with the domain_id as the key.

Code

function domain_domains($reset = FALSE) {
  static $domains;
  if (empty($domains) || $reset) {
    $domains = array();
    $domains[] = domain_default($reset);
    // Query the db for active domain records.
    $result = db_query("SELECT domain_id FROM {domain}");
    while ($data = db_fetch_array($result)) {
      $domain = domain_lookup($data['domain_id'], NULL, TRUE);
      $domains[$domain['domain_id']] = $domain;
    }
  }
  $sort = variable_get('domain_sort', 'id');
  uasort($domains, '_domain_'. $sort  .'_sort');
  return $domains;
}