You are here

function classified_load in Classified Ads 7.3

Same name and namespace in other branches
  1. 6.3 classified.module \classified_load()

Implements hook_load().

File

./classified.module, line 1205
A pure D7 classified ads module inspired by the ed_classified module.

Code

function classified_load($nodes) {
  if (!empty($nodes)) {
    $vocabulary_ids = array();
    foreach ($nodes as $node) {
      $vocabulary_ids[] = $node->vid;
    }

    /** @var SelectQuery $q */
    $q = db_select('classified_node', 'cn')
      ->fields('cn', array(
      'nid',
      'vid',
      'expires',
      'notify',
    ))
      ->condition('cn.vid', $vocabulary_ids, 'IN');
    $results = $q
      ->execute();
    foreach ($results as $result) {
      $nodes[$result->nid]->expires = $result->expires;
      $nodes[$result->nid]->notify = $result->notify;
    }
  }
}