You are here

function print_node_load in Printer, email and PDF versions 7

Implements hook_node_load().

File

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

Code

function print_node_load($nodes, $types) {
  $ids = array();
  foreach ($nodes as $node) {
    $ids[] = $node->nid;
  }
  $result = db_query('SELECT nid, link, comments, url_list FROM {print_node_conf} WHERE nid IN (:nids)', array(
    ':nids' => $ids,
  ))
    ->fetchAllAssoc('nid');
  foreach ($nodes as $node) {
    $node->print_display = isset($result[$node->nid]) ? intval($result[$node->nid]->link) : variable_get('print_display_' . $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
    $node->print_display_comment = isset($result[$node->nid]) ? intval($result[$node->nid]->comments) : variable_get('print_display_comment_' . $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
    $node->print_display_urllist = isset($result[$node->nid]) ? intval($result[$node->nid]->url_list) : variable_get('print_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
  }
}