function print_pdf_node_load in Printer, email and PDF versions 7
Same name and namespace in other branches
- 7.2 print_pdf/print_pdf.module \print_pdf_node_load()
Implements hook_node_load().
File
- print_pdf/
print_pdf.module, line 380 - Displays Printer-friendly versions of Drupal pages.
Code
function print_pdf_node_load($nodes, $types) {
$ids = array();
foreach ($nodes as $node) {
$ids[] = $node->nid;
}
$result = db_query('SELECT nid, link, comments, url_list FROM {print_pdf_node_conf} WHERE nid IN (:nids)', array(
':nids' => $ids,
))
->fetchAllAssoc('nid');
foreach ($nodes as $node) {
$node->print_pdf_display = isset($result[$node->nid]) ? intval($result[$node->nid]->link) : variable_get('print_pdf_display_' . $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
$node->print_pdf_display_comment = isset($result[$node->nid]) ? intval($result[$node->nid]->comments) : variable_get('print_pdf_display_comment_' . $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
$node->print_pdf_display_urllist = isset($result[$node->nid]) ? intval($result[$node->nid]->url_list) : variable_get('print_pdf_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
}
}