You are here

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

Same name and namespace in other branches
  1. 5.4 print_mail/print_mail.module \_print_mail_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_mail_set_node_fields()
print_mail_nodeapi in print_mail/print_mail.module
Implementation of hook_nodeapi().

File

print_mail/print_mail.module, line 324
Displays Printer-friendly versions of Drupal pages.

Code

function _print_mail_set_node_fields(&$node) {
  if (isset($node->nid)) {
    $res = db_fetch_object(db_query("SELECT link, comments, url_list FROM {print_mail_node_conf} WHERE nid = %d", $node->nid));
  }
  else {
    $res = FALSE;
  }
  $node->print_mail_display = $res ? intval($res->link) : variable_get('print_mail_display_' . $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
  $node->print_mail_display_comment = $res ? intval($res->comments) : variable_get('print_mail_display_comment_' . $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
  $node->print_mail_display_urllist = $res ? intval($res->url_list) : variable_get('print_mail_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
}