function chado_node_get_token_format
2.x tripal_core.chado_nodes.title_and_path.api.inc | chado_node_get_token_format($application, $content_type, $options = array()) |
3.x tripal_core.chado_nodes.title_and_path.inc | chado_node_get_token_format($application, $content_type, $options = array()) |
Get the format for the given application of a given content type (ie: the feature title)
Parameters
$application: What the format is to be applied to. For example 'title' for generating node titles and 'path' for generating node paths
$content_type: The name of the content type this format applies to (ie: $node->type)
$options: An array of any of the following options:
- return_record: if TRUE this will return the entire record rather than just the format string
Return value
A string specifying the format
2 calls to chado_node_get_token_format()
- chado_node_get_title_format in tripal_core/
api/ tripal_core.chado_nodes.title_and_path.api.inc - Get the title format for a specific content type
- chado_node_get_url_format in tripal_core/
api/ tripal_core.chado_nodes.title_and_path.api.inc - Get the url format for a specific content type
File
- tripal_core/
api/ tripal_core.chado_nodes.title_and_path.api.inc, line 1118 - Contains API functions to set titles and paths for all chado nodes
Code
function chado_node_get_token_format($application, $content_type, $options = array()) {
$format_record = db_select('tripal_token_formats', 't')
->fields('t')
->condition('content_type', $content_type, '=')
->condition('application', $application, '=')
->execute()
->fetchObject();
if (is_object($format_record)) {
if (isset($options['return_record'])) {
$format_record->tokens = unserialize($format_record->tokens);
return $format_record;
}
else {
return $format_record->format;
}
}
else {
return FALSE;
}
}