Project

General

Profile

« Previous | Next » 

Revision c2545e1c

Added by Andreas Kohlbecker almost 7 years ago

ref #6700 using nameType to distinguish name render part definitions

View differences:

modules/cdm_dataportal/includes/name.inc
229 229
    $part_definitions = convert_to_array(variable_get(CDM_PART_DEFINITIONS, $default_part_definitions));
230 230
  }
231 231

  
232
  $dtype = nameTypeToDTYPE($taxonNameType);
232 233
  if (array_key_exists($taxonNameType, $part_definitions)) {
233 234
    return $part_definitions[$taxonNameType];
235
  } else if (array_key_exists($dtype, $part_definitions)) {
236
    return $part_definitions[$dtype];
234 237
  } else {
235 238
    return $part_definitions['#DEFAULT']; // covers ViralNames and general NonViralNames
236 239
  }
......
287 290

  
288 291

  
289 292
  $renderTemplate = get_nameRenderTemplate(RenderHints::getRenderPath(), $nameLink, $refenceLink);
290
  $partDefinition = get_partDefinition($taxonName->class);
293
  $partDefinition = get_partDefinition($taxonName->nameType);
291 294

  
292 295
  // Apply definitions to template.
293 296
  foreach ($renderTemplate as $part => $uri) {
......
683 686
  }
684 687
  return $res;
685 688
}
689

  
690
function nameTypeToDTYPE($dtype){
691
  static $nameTypeLabelMap = array(
692
    "ICNB" => "BacterialName",
693
    "ICNAFP" => "BotanicalName",
694
    "ICNCP" => "CultivarPlantName",
695
    "ICZN" => "ZoologicalName",
696
    "ICVCN" => "ViralName",
697
    "Any taxon name" => "TaxonName",
698
    "NonViral" => "TaxonName",
699
    "Fungus" => "BotanicalName",
700
    "Plant" => "BotanicalName",
701
    "Algae" => "BotanicalName",
702
  );
703
  return $nameTypeLabelMap[$dtype];
704

  
705
}

Also available in: Unified diff