You are here

function print_pdf_nodeapi in Printer, email and PDF versions 5.3

Same name and namespace in other branches
  1. 5.4 print_pdf/print_pdf.module \print_pdf_nodeapi()
  2. 6 print_pdf/print_pdf.module \print_pdf_nodeapi()
  3. 5.x print_pdf/print_pdf.module \print_pdf_nodeapi()

Implementation of hook_nodeapi().

File

print_pdf/print_pdf.module, line 154

Code

function print_pdf_nodeapi(&$node, $op = 'view', $teaser, $page) {
  switch ($op) {
    case 'view':
      $print_pdf_link_pos = variable_get('print_pdf_link_pos', array(
        PRINT_PDF_LINK_POS_DEFAULT => PRINT_PDF_LINK_POS_DEFAULT,
      ));
      if ($teaser === FALSE && !empty($print_pdf_link_pos['corner']) && preg_match('!^print!i', $_GET['q']) == 0) {
        $link = print_pdf_insert_link(NULL, $node);
        if ($link) {
          $node->content['print_pdf_link'] = array(
            '#value' => "<span class='print-link'>{$link}</span>",
            '#weight' => -3,
          );
        }
      }
  }
}