function chado_node_get_legacy_title_default

2.x tripal_core.chado_nodes.title_and_path.api.inc chado_node_get_legacy_title_default($content_type)
3.x tripal_core.chado_nodes.title_and_path.inc chado_node_get_legacy_title_default($content_type)

Handles legacy title options

Features & Stocks already had custom functionality to handle title setting before this API was created. That has since been removed but but to remain backwards compatible this function checks for those old settings and translates them into new defaults.

Related topics

1 call to chado_node_get_legacy_title_default()
chado_node_get_title_format in legacy/tripal_core/api/tripal_core.chado_nodes.title_and_path.inc
Get the title format for a specific content type

File

legacy/tripal_core/api/tripal_core.chado_nodes.title_and_path.inc, line 482
Contains API functions to set titles and paths for all chado nodes

Code

function chado_node_get_legacy_title_default($content_type) {
  if ($content_type == 'chado_feature') {
    $legacy_option = variable_get('chado_feature_title', 'unique_constraint');
    switch ($legacy_option) {
      case 'feature_unique_name':
        $default_title_format = '[feature.uniquename]';
        break;
      case 'feature_name':
        $default_title_format = '[feature.name]';
        break;
      case 'unique_constraint':
        $default_title_format = '[feature.name], [feature.uniquename] ([feature.type_id>cvterm.name]) [feature.organism_id>organism.genus] [feature.organism_id>organism.species]';
        break;
    }
    return $default_title_format;
  }
  elseif ($content_type == 'chado_stock') {
    $legacy_option = variable_get('chado_stock_title', 'unique_constraint');
    switch ($legacy_option) {
      case 'stock_unique_name':
        $default_title_format = '[stock.uniquename]';
        break;
      case 'stock_name':
        $default_title_format = '[stock.name]';
        break;
      case 'unique_constraint':
        $default_title_format = '[stock.name], [stock.uniquename] ([stock.type_id>cvterm.name]) [stock.organism_id>organism.genus] [stock.organism_id>organism.species]';
        break;
    }
    return $default_title_format;
  }
  else {
    return FALSE;
  }
}