You are here

function domain_node_view in Domain Access 7.3

Same name and namespace in other branches
  1. 7.2 domain.module \domain_node_view()

Implements hook_node_view()

Display debugging information for a node.

File

./domain.module, line 1756
Core module functions for the Domain Access suite.

Code

function domain_node_view($node, $view_mode) {
  if (empty($node->nid) || !in_array($view_mode, array(
    'full',
    'teaser',
  ))) {
    return;
  }
  $output = '';
  if (variable_get('domain_debug', 0) && user_access('set domain access')) {
    if (!empty($node->subdomains)) {
      $items = array();
      foreach ($node->subdomains as $name) {
        $items[] = check_plain($name);
      }
      $output .= theme('item_list', array(
        'items' => $items,
        'title' => t('Assigned domains'),
      ));
    }
    if (!empty($node->editors)) {
      $items = array();
      foreach ($node->editors as $name) {
        $items[] = check_plain($name);
      }
      $output .= theme('item_list', array(
        'items' => $items,
        'title' => t('Editors'),
      ));
    }
    if (empty($output)) {
      $output = t('This node is not assigned to a domain.');
    }
    $node->content['domain'] = array(
      '#markup' => $output,
    );
  }
}