function tripal_example_node_update
2.x tripal_example.chado_node.inc | tripal_example_node_update($node) |
Implementation of hook node_update().
Performs actions after any node has been updated.
File
- tripal_example/
includes/ tripal_example.chado_node.inc, line 732 - This file should contain all Drupal hooks for interacting with nodes.
Code
function tripal_example_node_update($node) {
// EXPLANATION: This function is used after any a node is updated in the
// database. It is different from the hook_update() function above in that it
// is called after any node is updated, regardless of it's type.
// An example comes from the tripal_feature module where the URL alias of a
// node cannot be set in the hook_update() function. Therefore the
// tripal_feature module uses this function to reset the URL path of an
// updated feature node.
//
// This function is not required. You probably won't need it if you don't
// define a custom node type in the hook_node_info() function. But it is node
// type agnostic, so you can use this function to do any activity after insert
// of a node.
// add items to other nodes, build index and search results
switch ($node->type) {
case 'chado_example':
// If your module is using the Chado Node: Title & Path API to allow
// custom titles for your node type. Every time you want the title of the
// node, you need to use the following API function:
$example->title = chado_get_node_title($node);
// set the URL for this example page
// see the code in the tripal_feature/includes/tripal_feature.chado_node.inc
// file in the function tripal_feature_node_insert for an example of how
// that module sets the URL. It uses a configuration file to allow the
// user to dynamically build a URL schema and then uses that schema to
// generate a URL string.
break;
}
}