function tripal_library_node_insert

2.x tripal_library.chado_node.inc tripal_library_node_insert($node)
3.x tripal_library.chado_node.inc tripal_library_node_insert($node)

Implements hook_node_insert(). Acts on all content types.

Related topics

File

tripal_library/includes/tripal_library.chado_node.inc, line 643
Implements the library node content type

Code

function tripal_library_node_insert($node) {

  switch ($node->type) {
    case 'chado_library':

      $library_id = chado_get_id_from_nid('library', $node->nid);
      $values = array('library_id' => $library_id);
      $library = chado_generate_var('library', $values);
      $library = chado_expand_var($library, 'field', 'library.uniquename');
      $node->library = $library;

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

      // Now use the API to set the path.
      chado_set_node_url($node);

      break;
  }
}