You are here

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

Same name and namespace in other branches
  1. 5.4 print.module \_print_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_set_node_fields()
print_nodeapi in ./print.module
Implementation of hook_nodeapi().

File

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

Code

function _print_set_node_fields(&$node) {
  if (isset($node->nid)) {
    $res = db_fetch_object(db_query("SELECT link, comments, url_list FROM {print_node_conf} WHERE nid = %d", $node->nid));
  }
  else {
    $res = FALSE;
  }
  $node->print_display = $res ? intval($res->link) : variable_get('print_display_' . $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
  $node->print_display_comment = $res ? intval($res->comments) : variable_get('print_display_comment_' . $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
  $node->print_display_urllist = $res ? intval($res->url_list) : variable_get('print_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
}