You are here

function attachment_links_node_view in Attachment Links 7

Implements hook_node_view().

File

./attachment_links.module, line 43

Code

function attachment_links_node_view($node, $view_mode, $langcode) {
  $file_field_name = variable_get('attachment_links_selection_' . $node->type, 0);

  // Add the links to the node display, for easy access.
  if ($file_field_name) {

    // Grab the files from the current node for the selected field.
    $files = field_get_items('node', $node, $file_field_name);
    if ($files) {
      $node->content['attachment_links'] = array(
        '#markup' => theme('attachment_links', array(
          'node' => $node,
        )),
        '#weight' => 3,
      );
    }
  }
}