You are here

function print_mail_node_load in Printer, email and PDF versions 7

Implements hook_node_load().

File

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

Code

function print_mail_node_load($nodes, $types) {
  $ids = array();
  foreach ($nodes as $node) {
    $ids[] = $node->nid;
  }
  $result = db_query('SELECT nid, link, comments, url_list FROM {print_mail_node_conf} WHERE nid IN (:nids)', array(
    ':nids' => $ids,
  ))
    ->fetchAllAssoc('nid');
  foreach ($nodes as $node) {
    $node->print_mail_display = isset($result[$node->nid]) ? intval($result[$node->nid]->link) : variable_get('print_mail_display_' . $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
    $node->print_mail_display_comment = isset($result[$node->nid]) ? intval($result[$node->nid]->comments) : variable_get('print_mail_display_comment_' . $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
    $node->print_mail_display_urllist = isset($result[$node->nid]) ? intval($result[$node->nid]->url_list) : variable_get('print_mail_display_urllist_' . $node->type, PRINT_TYPE_URLLIST_DEFAULT);
  }
}