You are here

function domain_source_lookup in Domain Access 7.3

Same name and namespace in other branches
  1. 6.2 domain_source/domain_source.module \domain_source_lookup()
  2. 7.2 domain_source/domain_source.module \domain_source_lookup()

Get the source domains for multiple matches, mimicking node_load().

Parameters

$nid: A node id.

Return value

The domain_id of the canonical source domain or FALSE if not set.

4 calls to domain_source_lookup()
DomainSourceTest::testDomainSourceDefaults in domain_source/tests/domain_source.test
domain_source_domain_source_alter in domain_source/domain_source.domain.inc
Implements hook_domain_source_alter().
domain_source_validate in domain_source/domain_source.module
Form validation step
hook_domain_source_alter in ./domain.api.php
Allows modules to specify the target link for a node.

File

domain_source/domain_source.module, line 269
Creates a source domain for linking to content from other domains.

Code

function domain_source_lookup($nid) {
  $source = FALSE;
  if ($domain_source = db_query("SELECT domain_id FROM {domain_source} WHERE nid = :nid", array(
    ':nid' => $nid,
  ))
    ->fetchField()) {
    if ($domain_source == DOMAIN_SOURCE_USE_ACTIVE) {
      $source = $domain_source;
    }
    elseif ($domain = domain_lookup($domain_source)) {
      $source = $domain['domain_id'];
    }
  }
  return $source;
}