You are here

function print_nodeapi in Printer, email and PDF versions 5.3

Same name and namespace in other branches
  1. 5.4 print.module \print_nodeapi()
  2. 6 print.module \print_nodeapi()
  3. 5.x print.module \print_nodeapi()

Implementation of hook_nodeapi().

File

./print.module, line 224
Displays Printer-friendly versions of Drupal pages.

Code

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