function headerimage_node_load in Header image 7
Implementation of hook_node_load().
File
- ./
headerimage.module, line 647 - headerimage.module Conditionally display an node in a block.
Code
function headerimage_node_load($nodes, $types) {
$valid_types = variable_get('headerimage_node_type', array());
foreach ($nodes as $nid => $node) {
// Only operate on valid types.
if (!in_array($node->type, $valid_types, true)) {
continue;
}
// Load header image properties from the database.
$result = db_select('headerimage', 'hi')
->fields('hi')
->condition('nid', $node->nid)
->execute()
->fetchObject();
if ($result) {
$node->headerimage_block = $result->block;
$node->headerimage_weight = $result->weight;
$conditions = unserialize($result->conditions);
if (!empty($conditions)) {
foreach ($conditions as $condition => $value) {
$name = 'headerimage_condition_' . $condition;
if (!isset($node->{$name})) {
$node->{$name} = $value;
}
}
}
}
}
}