You are here

function print_mail_nodeapi in Printer, email and PDF versions 5.3

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

Implementation of hook_nodeapi().

File

print_mail/print_mail.module, line 130

Code

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