You are here

function forward_node_view in Forward 7.2

Same name and namespace in other branches
  1. 7 forward.module \forward_node_view()

Implements hook_node_view().

File

./forward.module, line 1046

Code

function forward_node_view($node, $view_mode) {
  if (user_access('access forward') && variable_get('forward_display_' . $node->type, 1)) {
    $show = $view_mode == 'full' && variable_get('forward_display_nodes', 1) || $view_mode == 'teaser' && variable_get('forward_display_teasers', 0);
    if (variable_get('forward_form_type', 'link') == 'link') {
      if ($show) {
        $link = forward_link_create($node);
        $links = array();
        $links['forward_link'] = array(
          'title' => $link['title'],
          'href' => 'forward',
          'html' => $link['html'],
          'attributes' => $link['attributes'],
          'query' => $link['query'],
        );
        $node->content['links']['forward'] = array(
          '#theme' => 'links',
          '#links' => $links,
          '#attributes' => array(
            'class' => array(
              'links',
              'inline',
            ),
          ),
        );
      }
    }
    elseif ($show && !isset($node->in_preview)) {
      $output = drupal_get_form('forward_form', 'node/' . $node->nid, $node, TRUE);
      $node->content['forward'] = $output;
    }
  }
}