function tripal_feature_node_insert

2.x tripal_feature.chado_node.inc tripal_feature_node_insert($node)
3.x tripal_feature.chado_node.inc tripal_feature_node_insert($node)

Implements hook_node_insert(). Acts on all content types.

Related topics

File

tripal_feature/includes/tripal_feature.chado_node.inc, line 791
Implementation of hooks to create a feature content type

Code

function tripal_feature_node_insert($node) {
  // set the URL path after inserting.  We do it here because we do not
  // know the feature_id in the presave
  switch ($node->type) {
    case 'chado_feature':

      // We still don't have a fully loaded node object in this hook. Therefore,
      // we need to simulate one so that the right values are available for
      // the URL to be determined.
      $feature_id = chado_get_id_from_nid('feature', $node->nid);
      $node->feature = chado_generate_var('feature', array('feature_id' => $feature_id));

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

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