function chado_organism_load
2.x tripal_organism.chado_node.inc | chado_organism_load($nodes) |
3.x tripal_organism.chado_node.inc | chado_organism_load( |
1.x tripal_organism.module | chado_organism_load($node) |
Implements hook_load().
When a node is requested by the user this function is called to allow us to add auxiliary data to the node object.
Related topics
File
- tripal_organism/
includes/ tripal_organism.chado_node.inc, line 620 - Implements the organims node content type
Code
function chado_organism_load($nodes) {
foreach ($nodes as $nid => $node) {
// find the organism and add in the details
$organism_id = chado_get_id_from_nid('organism', $nid);
// if the nid does not have a matching record then skip this node.
// this can happen with orphaned nodes.
if (!$organism_id) {
continue;
}
// build the organism variable
$values = array('organism_id' => $organism_id);
$organism = chado_generate_var('organism', $values);
// add in the description field
$organism = chado_expand_var($organism, 'field', 'organism.comment');
$nodes[$nid]->organism = $organism;
// Now get the title
$node->title = chado_get_node_title($node);
}
}