function quotes_load in Quotes 7
Same name and namespace in other branches
- 5 quotes.module \quotes_load()
- 6 quotes.module \quotes_load()
Implements hook_load().
File
- ./
quotes.module, line 460 - The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.
Code
function quotes_load($nodes) {
foreach ($nodes as $node) {
// Check node access then continue if allowed or skip to next node.
if (node_access('view', $node)) {
try {
$obj = db_select('quotes', 'q');
$alias = $obj
->join('quotes_authors', 'a', 'q.aid = a.aid');
$f_aa = $obj
->addField('a', 'aid', 'quotes_aid');
$f_an = $obj
->addField('a', 'name', 'quotes_author');
$f_ab = $obj
->addField('a', 'bio', 'quotes_bio');
$f_qc = $obj
->addField('q', 'citation', 'quotes_citation');
$f_qp = $obj
->addField('q', 'promote', 'quotes_promote');
$obj1 = $obj
->condition('q.vid', $node->vid)
->execute()
->fetchObject();
} catch (Exception $e) {
drupal_set_message(t('db_insert failed. Message = %message, query= %query', array(
'%message' => $e
->getMessage(),
'%query' => $e->query_string,
)), 'error');
}
if ($obj1) {
foreach ($obj1 as $property => $value) {
$nodes[$node->nid]->{$property} = $value;
}
}
}
}
}