Project

General

Profile

« Previous | Next » 

Revision a0e3ae5c

Added by Andreas Kohlbecker over 7 years ago

ref #6203 checked return types of classification services and updated documentation

View differences:

modules/cdm_dataportal/cdm_dataportal.module
2091 2091

  
2092 2092

  
2093 2093
/**
2094
 * Creates a short taxonname.
2094
 * Creates a short version of a taxonname.
2095 2095
 *
2096 2096
 * The short name is created by using the taggedTitle field of
2097
 * NameSTO or NameTO instances.
2097
 * TaxonNodeDTO instances.
2098 2098
 * If the taggedTitle if empty the fullname will be returned.
2099 2099
 *
2100
 * @param unknown_type $name
2101
 *   Name or TreeNode.
2100
 * @param object $taxonNodeDTO
2101
 *   A TaxonNodeDTO object
2102 2102
 *
2103 2103
 * @return string
2104 2104
 */
2105
function cdm_dataportal_shortname_of($name) {
2105
function cdm_dataportal_shortname_of($taxonNodeDTO) {
2106

  
2106 2107
  $nameStr = '';
2107 2108

  
2108
  normalize_tagged_text($name->taggedTitle);
2109
  normalize_tagged_text($taxonNodeDTO->taggedTitle);
2109 2110

  
2110 2111
  // Get all tagged text tokens of the scientific name.
2111
  foreach ($name->taggedTitle as $tagtxt) {
2112
  foreach ($taxonNodeDTO->taggedTitle as $tagtxt) {
2112 2113
    if ($tagtxt->type == 'name' || $tagtxt->type == 'rank') {
2113 2114
      $nameStr .= ($nameStr ? ' ' : '') . $tagtxt->text;
2114 2115
    }
......
2118 2119
  if ($nameStr) {
2119 2120

  
2120 2121
    // Do not return short names for these.
2121
    if ($name->unplaced || $name->excluded) {
2122
    if ($taxonNodeDTO->unplaced || $taxonNodeDTO->excluded) {
2122 2123
      return $nameStr;
2123 2124
    }
2124 2125

  
......
2138 2139
    }
2139 2140
  }
2140 2141
  else {
2141
    return $name->titleCache;
2142
    return $taxonNodeDTO->titleCache;
2142 2143
  }
2143 2144
}
2144 2145

  

Also available in: Unified diff