function tripal_analysis_node_insert
2.x tripal_analysis.chado_node.inc | tripal_analysis_node_insert($node) |
3.x tripal_analysis.chado_node.inc | tripal_analysis_node_insert($node) |
Implements hook_node_insert(). Acts on all content types.
Related topics
File
- tripal_analysis/
includes/ tripal_analysis.chado_node.inc, line 748 - Implements Drupal Node hooks to create the chado_analysis node content type.
Code
function tripal_analysis_node_insert($node) {
switch ($node->type) {
case 'chado_analysis':
// 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.
$analysis_id = chado_get_id_from_nid('analysis', $node->nid);
$values = array('analysis_id' => $analysis_id);
$analysis = chado_generate_var('analysis', $values);
$node->analysis = $analysis;
// 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;
}
}