当前,每次创建或更新节点时都尝试更新字段。但是,该值未在节点内填充,我是否可以使用此特定的钩子访问节点对象?我可能会缺少什么?
function vbtoken_node_update($node) {
entity_get_controller('node')->resetCache(array($node->nid));
$types = node_type_get_types(); //What are the current Node Content Types?
$yes = ($types['volunteer_project']->type);
if($node->type === $yes){
$hash = md5($node->title . $node->nid . $node->nid);
$hashed = substr($hash, 0, 6);
$node = node_load($node->nid);
$node->tcode[$node->language][0]['value'] = $hashed;
node_save($node);
watchdog('vbtoken', 'Added a new Token code to %nid', array('%nid' => $node->nid));
}
else
{
dpm('not working dude');
}
}