function chado_get_node_title
2.x tripal_core.chado_nodes.title_and_path.api.inc | chado_get_node_title($node) |
3.x tripal_core.chado_nodes.title_and_path.inc | chado_get_node_title($node) |
Get the title of a node based on the Title Format set in the admin section of the module. If the format has not yet been set than the the unique constrain and name fields will be used to generate a default format
Parameters
$node: The node object
Related topics
33 calls to chado_get_node_title()
- chado_analysis_load in tripal_analysis/
includes/ tripal_analysis.chado_node.inc - Implements hook_load(). When a node is requested by the user this function is called to allow us to add auxiliary data to the node object.
- chado_contact_load in tripal_contact/
includes/ tripal_contact.chado_node.inc - Implements hook_load().
- chado_example_load in tripal_example/
includes/ tripal_example.chado_node.inc - Implementation of hook_load(). This function is necessary to load into the $node object the fields of the table form Chado. For example for the example table, the chado_example_load() function adds in a example object which contains all of the fields…
- chado_featuremap_load in tripal_featuremap/
includes/ tripal_featuremap.chado_node.inc - Implements hook_load().
- chado_feature_load in tripal_feature/
includes/ tripal_feature.chado_node.inc - Implements hook_load().
File
- tripal_core/
api/ tripal_core.chado_nodes.title_and_path.api.inc, line 196 - Contains API functions to set titles and paths for all chado nodes
Code
function chado_get_node_title($node) {
$content_type = $node->type;
// Get the tokens and format
$tokens = array(); // this will be set by chado_node_get_title_format
$title = chado_node_get_title_format($content_type, $tokens);
// Determine which tokens were used in the format string
if (preg_match_all('/\[[^]]+\]/', $title, $used_tokens)) {
// Get the value for each token used
foreach ($used_tokens[0] as $token) {
$token_info = $tokens[$token];
if (!empty($token_info)) {
$value = chado_get_token_value($token_info, $node);
$title = str_replace($token, $value, $title);
}
}
}
else {
return $title;
}
return $title;
}