function chado_pub_load
2.x tripal_pub.chado_node.inc | chado_pub_load($nodes) |
3.x tripal_pub.chado_node.inc | chado_pub_load( |
1.x tripal_pub.module | chado_pub_load($node) |
Implements hook_load().
Parameters
$node: The node that is to be loaded
Return value
$node The node with the information to be loaded into the database
Related topics
File
- legacy/
tripal_pub/ includes/ tripal_pub.chado_node.inc, line 992 - Implements Drupal Node hooks to create the chado_analysis node content type.
Code
function chado_pub_load($nodes) {
foreach ($nodes as $nid => $node) {
// find the pub and add in the details
$pub_id = chado_get_id_from_nid('pub', $nid);
// if the nid does not have a matching record then skip this node.
// this can happen with orphaned nodes.
if (!$pub_id) {
continue;
}
// get the pub
$values = array('pub_id' => $pub_id);
$pub = chado_generate_var('pub', $values);
// expand the 'text' fields as those aren't included by default
// and they really shouldn't be so large to cause problems
$pub = chado_expand_var($pub, 'field', 'pub.title');
$pub = chado_expand_var($pub, 'field', 'pub.volumetitle');
$pub = chado_expand_var($pub, 'field', 'pub.uniquename');
// set the URL path
$nodes[$nid]->path = "pub/$pub_id";
$nodes[$nid]->pub = $pub;
// Now get the title
$node->title = chado_get_node_title($node);
}
}