function tripal_contact_node_insert

2.x tripal_contact.chado_node.inc tripal_contact_node_insert($node)
3.x tripal_contact.chado_node.inc tripal_contact_node_insert($node)

Implements hook_node_insert(). Acts on all content types.

Related topics

File

tripal_contact/includes/tripal_contact.chado_node.inc, line 666
Implements drupal node hooks.

Code

function tripal_contact_node_insert($node) {

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

      // find the contact and add in the details
      $contact_id = chado_get_id_from_nid('contact', $node->nid);

      // get the contact
      $values = array('contact_id' => $contact_id);
      $contact = chado_generate_var('contact', $values);
      $node->contact = $contact;

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