function domain_get_node_match in Domain Access 7.2
Same name and namespace in other branches
- 6.2 domain.module \domain_get_node_match()
- 7.3 domain.module \domain_get_node_match()
Get the best matching domain for a node link.
Parameters
$nid: The node id.
Return value
The domain array for the best matching domain for links to this node.
4 calls to domain_get_node_match()
- domain_block_view_information in ./
domain.blocks.inc - Prints information about the current node.
- domain_invalid_domain_requested in ./
domain.module - Redirect a request to an invalid domain.
- domain_source_node_view in domain_source/
domain_source.module - Implements hook_node_view()
- domain_url_outbound_alter in ./
settings_custom_url.inc - Implements hook_url_outbound_alter().
File
- ./
domain.module, line 1529 - Core module functions for the Domain Access suite.
Code
function domain_get_node_match($nid) {
static $domain = array();
if (isset($domain[$nid])) {
return $domain[$nid];
}
// Load the domain data for this node -- but only take the first match.
$id = db_query("SELECT gid FROM {domain_access} WHERE nid = :nid AND realm = :realm ORDER BY gid", array(
':nid' => $nid,
':realm' => 'domain_id',
))
->fetchField();
// If a match was found, return it. Otherwise, we may be saving a node
// in which case, let it fall through. See http://drupal.org/node/624360.
$source = NULL;
if ($id !== FALSE) {
$source = domain_lookup($id);
drupal_alter('domain_source', $source, $nid);
$domain[$nid] = $source;
}
return $source;
}