function chado_featuremap_load

2.x tripal_featuremap.chado_node.inc chado_featuremap_load($nodes)
3.x tripal_featuremap.chado_node.inc chado_featuremap_load($nodes)
1.x tripal_featuremap.module chado_featuremap_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

legacy/tripal_featuremap/includes/tripal_featuremap.chado_node.inc, line 418
Hooks implementing the feature map node content type

Code

function chado_featuremap_load($nodes) {
  foreach ($nodes as $nid => $node) {
    // get the feature details from chado
    $featuremap_id = chado_get_id_from_nid('featuremap', $node->nid);

    // if the nid does not have a matching record then skip this node.
    // this can happen with orphaned nodes.
    if (!$featuremap_id) {
      continue;
    }

    $values = array('featuremap_id' => $featuremap_id);
    $featuremap = chado_generate_var('featuremap', $values);

    // expand the description field as it is needed by the form
    $featuremap = chado_expand_var($featuremap, 'field', 'featuremap.description');

    $nodes[$nid]->featuremap = $featuremap;

    // Now get the title
    $node->title = chado_get_node_title($node);
  }

}