Project

General

Profile

« Previous | Next » 

Revision 471192e3

Added by Andreas Kohlbecker over 5 years ago

fix #7616 implementing display of name type designations for the reference page

View differences:

modules/cdm_dataportal/cdm_dataportal.module
1941 1941

  
1942 1942
    if(is_object($registration_dto->orderdTypeDesignationWorkingSets)){
1943 1943
      $field_unit_uuids = array();
1944
      $name_type_designation_refs = array();
1944 1945
      foreach((array)$registration_dto->orderdTypeDesignationWorkingSets as $field_unit_ref => $obj){
1945 1946
        $tokens = explode("#", $field_unit_ref);
1946
        $field_unit_uuids[] = $tokens[1];
1947
        if($tokens[0] == 'NameTypeDesignation') {
1948
          foreach($obj as $type_status => $entity_reference){
1949
            // NOTE: there is always only one element, since we use the foreach to extract the field name an value
1950
            $name_type_designation_refs[$type_status] = $entity_reference[0];
1951
          }
1952
        } else {
1953
         $field_unit_uuids[] = $tokens[1];
1954
        }
1955
      }
1956
      if(count($name_type_designation_refs) > 0){
1957
        $render_array['name_type_designations'] = compose_name_type_designations($name_type_designation_refs);
1958
      }
1959
      if(count($field_unit_uuids) > 0){
1960
        $render_array['specimen_table'] = compose_specimen_table($field_unit_uuids);
1947 1961
      }
1948
      $render_array['specimen_table'] = compose_specimen_table($field_unit_uuids);
1949 1962
    }
1950 1963

  
1951 1964
  } else {
modules/cdm_dataportal/includes/name.inc
565 565
  return $registration_markup;
566 566
}
567 567

  
568

  
569
/**
570
 * Composes the TypedEntityReference to name type designations passed as associatve array.
571
 *
572
 * @param $name_type_designations array
573
 *   an associative array of name type type => TypedEntityReference for name type designations as
574
 *   produced by the eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager
575
 *
576
 * @ingroup compose
577
 */
578
function compose_name_type_designations($type_entity_refs){
579
  $render_array = array();
580
  foreach($type_entity_refs as $type_status => $name_type){
581
    $render_array[] = markup_to_render_array('<div class="name_type_designation ' . html_class_attribute_ref($name_type)  . '"><span class="type_status">'. ucfirst($type_status) . "</span>: " . $name_type->label . '</div>');
582
  }
583
  return $render_array;
584
}
585

  
568 586
/**
569 587
 * Renders the name relationships.
570 588
 *

Also available in: Unified diff