You are here

function hook_domain_source_alter in Domain Access 7.3

Same name and namespace in other branches
  1. 8 domain_source/domain_source.api.php \hook_domain_source_alter()
  2. 6.2 API.php \hook_domain_source_alter()
  3. 7.2 domain.api.php \hook_domain_source_alter()

Allows modules to specify the target link for a node.

Parameters

&$source: The domain array from domain_get_node_match(), passed by reference.

$nid: The node id.

Return value

No return value; modify $source by reference.

1 function implements hook_domain_source_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

domain_source_domain_source_alter in domain_source/domain_source.domain.inc
Implements hook_domain_source_alter().
2 invocations of hook_domain_source_alter()
domain_get_node_match in ./domain.module
Get the best matching domain for a node link.
domain_url_outbound_alter in ./settings_custom_url.inc
Implements hook_url_outbound_alter().

File

./domain.api.php, line 255
API documentation file.

Code

function hook_domain_source_alter(&$source, $nid) {

  // Taken from the Domain Source module
  $source_id = domain_source_lookup($nid);

  // If FALSE returned, no source is defined.
  if (!$source_id) {
    return;
  }

  // DOMAIN_SOURCE_USE_ACTIVE is the status for 'Use active domain.'
  if ($source_id == DOMAIN_SOURCE_USE_ACTIVE) {
    $source = domain_get_domain();
  }
  else {
    $source = domain_lookup($source_id);
  }
}