function chado_library_load
2.x tripal_library.chado_node.inc | chado_library_load($nodes) |
3.x tripal_library.chado_node.inc | chado_library_load( |
1.x tripal_library.module | chado_library_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_library/
includes/ tripal_library.chado_node.inc, line 414 - Implements the library node content type
Code
function chado_library_load($nodes) {
foreach ($nodes as $nid => $node) {
// get the feature details from chado
$library_id = chado_get_id_from_nid('library', $node->nid);
// if the nid does not have a matching record then skip this node.
// this can happen with orphaned nodes.
if (!$library_id) {
continue;
}
$values = array('library_id' => $library_id);
$library = chado_generate_var('library', $values);
// the uniquename field is a text field so we need to expand it
$library = chado_expand_var($library, 'field', 'library.uniquename');
$nodes[$nid]->library = $library;
// Now get the title
$node->title = chado_get_node_title($node);
}
}