function tripal_library_node_presave
2.x tripal_library.chado_node.inc | tripal_library_node_presave($node) |
3.x tripal_library.chado_node.inc | tripal_library_node_presave($node) |
Implements hook_node_presave(). Acts on all node content types.
Related topics
File
- tripal_library/
includes/ tripal_library.chado_node.inc, line 614 - Implements the library node content type
Code
function tripal_library_node_presave($node) {
switch ($node->type) {
// This step is for setting the title for the Drupal node. This title
// is permanent and thus is created to be unique. Title changes provided
// by tokens are generated on the fly dynamically, but the node title
// seen in the content listing needs to be set here. Do not call
// the chado_get_node_title() function here to set the title as the node
// object isn't properly filled out and the function will fail.
case 'chado_library':
// for a form submission the 'libraryname' field will be set,
// for a sync, we must pull from the library object
if (property_exists($node, 'libraryname')) {
// set the title
$node->title = $node->libraryname;
}
else if (property_exists($node, 'library')) {
$node->title = $node->library->name;
}
break;
}
}