You are here

function simplenews_scheduler_node_load in Simplenews Scheduler 7

Implements hook_node_load().

File

./simplenews_scheduler.module, line 281
Simplenews Scheduler module allows a schedule to be set for sending (and resending) a Simplenews item.

Code

function simplenews_scheduler_node_load($nodes, $types) {
  $nids = array_keys($nodes);
  $result = db_select('simplenews_scheduler', 's')
    ->fields('s')
    ->condition('nid', $nids, 'IN')
    ->execute()
    ->fetchAll();
  foreach ($result as $key => $record) {
    $nodes[$record->nid]->simplenews_scheduler = $record;
  }
  $result = db_select('simplenews_scheduler_editions', 's')
    ->fields('s')
    ->condition('eid', $nids, 'IN')
    ->execute()
    ->fetchAll();
  foreach ($result as $key => $record) {
    $nodes[$record->eid]->simplenews_scheduler_edition = $record;
    $nodes[$record->eid]->is_edition = TRUE;
    $nodes[$record->eid]->simplenews_edition_parent = $record->pid;
  }
}