You are here

function _print_pdf_set_node_fields in Printer, email and PDF versions 5.x

Same name and namespace in other branches
  1. 5.4 print_pdf/print_pdf.module \_print_pdf_set_node_fields()

Auxiliary function to assign the per-node settings to the node object fields

Parameters

$node: node to be modified

1 call to _print_pdf_set_node_fields()
print_pdf_nodeapi in print_pdf/print_pdf.module
Implementation of hook_nodeapi().

File

print_pdf/print_pdf.module, line 370
Displays Printer-friendly versions of Drupal pages.

Code

function _print_pdf_set_node_fields(&$node) {
  if (isset($node->nid)) {
    $res = db_fetch_object(db_query("SELECT link, comments, url_list FROM {print_pdf_node_conf} WHERE nid = %d", $node->nid));
  }
  else {
    $res = FALSE;
  }
  $node->print_pdf_display = $res ? intval($res->link) : variable_get('print_pdf_display_' . $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
  $node->print_pdf_display_comment = $res ? intval($res->comments) : variable_get('print_pdf_display_comment_' . $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
  $node->print_pdf_display_urllist = $res ? intval($res->url_list) : variable_get('print_pdf_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
}