function chado_library_view

1.x tripal_library.module chado_library_view($node, $teaser = FALSE, $page = FALSE)

This function customizes the view of the chado_library node. It allows us to generate the markup. This function is required for node [Preview]

Related topics

File

tripal_library/tripal_library.module, line 656

Code

function chado_library_view($node, $teaser = FALSE, $page = FALSE) {
  // use drupal's default node view:
  if (!$teaser) {

    $node = node_prepare($node, $teaser);

    // If Hook_view() is called by Hook_form(), we'll only have orgnism_id
    // but not genus/species/common_name. We need to get those from chado
    // database so they will show up in preview
    if (!$node->genus) {
      $sql = "SELECT * FROM {organism} WHERE organism_id = %d";
      $data = db_fetch_object(chado_query($sql, $node->organism_id));
      $node->genus = $data->genus;
      $node->species = $data->species;
      $node->common_name = $data->common_name;
    }
  }
  return $node;
}