You are here

function domain_domains in Domain Access 7.2

Same name and namespace in other branches
  1. 5 domain.module \domain_domains()
  2. 6.2 domain.module \domain_domains()
  3. 7.3 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.

24 calls to domain_domains()
domain_alias_block in domain_alias/domain_alias.module
Implements hook_block().
domain_alias_block_view in domain_alias/domain_alias.module
Implements hook_block_view().
domain_batch in ./domain.admin.inc
Allows for the batch update of certain elements.
domain_block_view_switcher in ./domain.blocks.inc
A nifty little domain-switcher block, useful during debugging.
domain_configure_form in ./domain.admin.inc
FormsAPI for configuring the domain module.

... See full list

File

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

Code

function domain_domains($reset = FALSE) {
  static $domains;
  if (empty($domains) || $reset) {
    $domains = array();

    // Query the db for active domain records.
    $result = db_query("SELECT domain_id FROM {domain}", array(), array(
      'fetch' => PDO::FETCH_ASSOC,
    ));
    foreach ($result as $data) {
      $domain = domain_lookup($data['domain_id'], NULL, $reset);
      $domains[$domain['domain_id']] = $domain;
    }
  }
  $sort = variable_get('domain_sort', 'id');
  uasort($domains, '_domain_' . $sort . '_sort');
  return $domains;
}