You are here

function domain_domains in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain.module \domain_domains()
  2. 7.3 domain.module \domain_domains()
  3. 7.2 domain.module \domain_domains()

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.

12 calls to domain_domains()
domain_batch in ./domain_admin.inc
Allows for the batch update of certain elements.
domain_block in ./domain.module
Implement hook_block()
domain_configure_form in ./domain_admin.inc
FormsAPI for configuring the domain module.
domain_content_form in domain_content/domain_content.module
Rewrites node_admin_nodes() to use db_rewrite_sql().
domain_content_menu in domain_content/domain_content.module
Implement hook_menu()

... See full list

File

./domain.module, line 494
Core module functions for the Domain Access suite.

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;
}