private static function NodeHookHandler::doNodeLoad in Node expire 7.2
Implements hook_node_load().
1 call to NodeHookHandler::doNodeLoad()
- NodeHookHandler::hookNodeLoad in src/
Module/ Hook/ NodeHookHandler.php - Implements hook_node_load().
File
- src/
Module/ Hook/ NodeHookHandler.php, line 109 - NodeHookHandler class.
Class
- NodeHookHandler
- NodeHookHandler class.
Namespace
Drupal\node_expire\Module\HookCode
private static function doNodeLoad($nodes, $types) {
// Only deal with node types that have the Node expire feature enabled.
$ntypes = variable_get('node_expire_ntypes', array());
$node_expire_enabled = array();
// Check if node_expire are enabled for each node.
// If node_expires are not enabled, do nothing.
foreach ($nodes as $node) {
// Store whether node_expires are enabled for this node.
if (isset($ntypes[$node->type]) and $ntypes = $ntypes[$node->type]) {
$node_expire_enabled[] = $node->nid;
}
}
// For nodes with node_expire enabled, fetch information from the database.
if (!empty($node_expire_enabled)) {
$handle_content_expiry = ConfigHandler::getHandleContentExpiry();
$result = DbHandler::selectForNodeLoad($node_expire_enabled);
foreach ($result as $record) {
if ($handle_content_expiry == 0) {
$nodes[$record->nid]->expire = $record->expire;
}
else {
$ntype = isset($ntypes[$record->type]) ? $ntypes[$record->type] : NULL;
$nodes[$record->nid]->expire = TimestampUtils::dateDbToStr($record->expire, $ntype);
}
$nodes[$record->nid]->expired = $record->expired;
$nodes[$record->nid]->lastnotify = $record->lastnotify;
}
}
}