function chado_analysis_load

2.x chado_analysis_load($nodes)
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.

Related topics


tripal_analysis/includes/, line 573
Implements Drupal Node hooks to create the chado_analysis node content type.


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) {

    // 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);