You are here

function domain_source_node_view in Domain Access 7.3

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

Implements hook_node_view()

Display debugging information for a node.

File

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

Code

function domain_source_node_view($node, $view_mode) {
  if (empty($node->nid) || !in_array($view_mode, array(
    'full',
    'teaser',
  )) || !variable_get('domain_debug', 0) || !user_access('set domain access')) {
    return;
  }
  $_domain = domain_get_domain();
  $source = domain_get_node_match($node->nid);
  if (is_null($node->domain_source)) {
    $node->content['domain']['#markup'] .= '<p>' . t('<strong>Source domain</strong>: %source (determined automatically)', array(
      '%source' => $source['sitename'],
    )) . '</p>';
  }
  elseif ($node->domain_source == DOMAIN_SOURCE_USE_ACTIVE) {
    $node->content['domain']['#markup'] .= '<p>' . t('<strong>Source domain</strong>: %source (using active domain)', array(
      '%source' => $_domain['sitename'],
    )) . '</p>';
  }
  else {
    $node->content['domain']['#markup'] .= '<p>' . t('<strong>Source domain</strong>: %source', array(
      '%source' => $source['sitename'],
    )) . '</p>';
  }
}