function tripal_project_node_insert
2.x tripal_project.chado_node.inc | tripal_project_node_insert($node) |
3.x tripal_project.chado_node.inc | tripal_project_node_insert($node) |
Implements hook_node_insert(). Acts on all content types.
Related topics
File
- legacy/
tripal_project/ includes/ tripal_project.chado_node.inc, line 539 - Implement the project node content type
Code
function tripal_project_node_insert($node) {
// set the URL path after inserting. We do it here because we do not
// know the project_id in the presave
switch ($node->type) {
case 'chado_project':
// 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.
$project_id = chado_get_id_from_nid('project', $node->nid);
$node->project = chado_generate_var('project', array('project_id' => $project_id));
// 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;
}
}