function print_nodeapi in Printer, email and PDF versions 5.x
Same name and namespace in other branches
- 5.4 print.module \print_nodeapi()
- 5.3 print.module \print_nodeapi()
- 6 print.module \print_nodeapi()
Implementation of hook_nodeapi().
File
- ./
print.module, line 383 - Displays Printer-friendly versions of Drupal pages.
Code
function print_nodeapi(&$node, $op = 'view', $teaser, $page) {
switch ($op) {
case 'view':
// Insert content corner links
if (!$teaser && isset($node->build_mode) && $node->build_mode === NODE_BUILD_NORMAL) {
$node->content['print_links'] = array(
'#prefix' => '<span class="print-link">',
'#value' => '',
'#suffix' => '</span>',
'#weight' => -101,
);
$print_html_link_pos = variable_get('print_html_link_pos', array(
PRINT_HTML_LINK_POS_DEFAULT => PRINT_HTML_LINK_POS_DEFAULT,
));
if (!empty($print_html_link_pos['corner'])) {
$node->content['print_links']['#value'] .= print_insert_link(NULL, $node);
}
}
break;
case 'load':
_print_set_node_fields($node);
break;
case 'insert':
case 'update':
if (user_access('administer print') || user_access('node-specific print configuration')) {
if ($node->print_display === NULL) {
$node->print_display = variable_get('print_display_' . $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
}
if ($node->print_display_comment === NULL) {
$node->print_display_comment = variable_get('print_display_comment_' . $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
}
if ($node->print_display_urllist === NULL) {
$node->print_display_urllist = variable_get('print_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
}
_print_node_conf_modify($node->nid, $node->print_display, $node->print_display_comment, $node->print_display_urllist);
}
break;
case 'delete':
db_query("DELETE FROM {print_node_conf} WHERE nid = %d", $node->nid);
db_query("DELETE FROM {print_page_counter} WHERE path = 'node/%d'", $node->nid);
break;
}
}