function chado_analysis_load
2.x tripal_analysis.chado_node.inc | chado_analysis_load($nodes) |
3.x tripal_analysis.chado_node.inc | chado_analysis_load( |
1.x tripal_analysis.module | chado_analysis_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.
File
- legacy/
tripal_analysis/ includes/ tripal_analysis.chado_node.inc, line 573 - Implements Drupal Node hooks to create the chado_analysis node content type.
Code
function chado_analysis_load($nodes) {
foreach ($nodes as $nid => $node) {
// find the analysis and add in the details
$analysis_id = chado_get_id_from_nid('analysis', $nid);
// if the nid does not have a matching record then skip this node.
// this can happen with orphaned nodes.
if (!$analysis_id) {
continue;
}
// build the analysis variable
$values = array('analysis_id' => $analysis_id);
$analysis = chado_generate_var('analysis', $values);
// add in the description field
$analysis = chado_expand_var($analysis, 'field', 'analysis.description');
$nodes[$nid]->analysis = $analysis;
// Now get the title
$node->title = chado_get_node_title($node);
}
}