You are here

function domain_content_view_domains in Domain Access 7.2

Same name and namespace in other branches
  1. 7.3 domain_content/domain_content.admin.inc \domain_content_view_domains()

Format domains for this node.

1 call to domain_content_view_domains()
domain_content_form in domain_content/domain_content.admin.inc
Rewrites node_admin_nodes() to use db_rewrite_sql().

File

domain_content/domain_content.admin.inc, line 406
Administration pages for Domain Content.

Code

function domain_content_view_domains($node) {
  $node_domains = array();
  if (!empty($node->domains)) {
    foreach ($node->domains as $domain) {

      // The root domain is stored as -1, but cast as zero in the global variable.
      $key = $domain == -1 ? 0 : $domain;

      // Convert the domain ids to data so we can print them.
      $node_domains[] = domain_lookup($key);
    }
  }

  // If we have multiple domains, print them.
  $items = array();
  if ($node->domain_site) {
    $items[-1] = t('All affiliates');
  }
  if (!empty($node_domains)) {
    foreach ($node_domains as $item) {
      $items[$item['domain_id']] = check_plain($item['sitename']);
    }
  }
  if (module_exists('domain_source')) {
    $source = NULL;
    $source = db_query("SELECT domain_id FROM {domain_source} WHERE nid = :nid", array(
      ':nid' => $node->nid,
    ))
      ->fetchField();
    if (!empty($source) && isset($items[$source])) {
      $items[$source] .= '*';
    }
  }
  return theme('item_list', array(
    'items' => $items,
  ));
}