function tripal_contact_node_presave
2.x tripal_contact.chado_node.inc | tripal_contact_node_presave($node) |
3.x tripal_contact.chado_node.inc | tripal_contact_node_presave($node) |
Implements hook_node_presave().
File
- legacy/
tripal_contact/ includes/ tripal_contact.chado_node.inc, line 644 - Implements drupal node hooks.
Code
function tripal_contact_node_presave($node) {
switch ($node->type) {
case 'chado_contact':
// for a form submission the 'contactname' field will be set,
// for a sync, we must pull from the contact object
if (property_exists($node, 'contactname')) {
// set the title
$node->title = $node->contactname;
}
else if (property_exists($node, 'contact')) {
$node->title = $node->contact->name;
}
break;
}
}