Project

General

Profile

« Previous | Next » 

Revision 4b3be949

Added by Andreas Kohlbecker over 7 years ago

fix #6278 sec uuid and taxon uuid as class attribute to all taxon and taxon node markup

View differences:

modules/cdm_dataportal/cdm_dataportal.module
2101 2101

  
2102 2102
/**
2103 2103
 * Composes an HTML element class attribute value composed of
2104
 * the shortname of the cdm class and the uuid of the entity.
2105
 * This class attribute should be used whereever an cdm-entity is rendered.
2104
 * the short-name of the cdm class and the uuid of the entity.
2105
 * This class attribute should be used wherever an cdm-entity is rendered.
2106
 *
2107
 * In case of Taxon entities or TaxonNodeDTOs the secReference is also added
2108
 * to the class attributes as 'sec_uuid:<uuid>'. In case of TaxonNodeDTOs the
2109
 * Taxon uuid is added also as taxon_uuid:<uuid>
2106 2110
 *
2107 2111
 * These according class selectors in css must be escaped, eg:
2108 2112
 *    .cdm\:TextData
2109 2113
 *
2110 2114
 * @param $cdmEntity
2115
 *    A CDM entity or TaxonNodeDTO
2111 2116
 */
2112 2117
function html_class_attribute_ref($cdmEntity) {
2113 2118

  
2119
  $attributes = '';
2114 2120
  if (is_cdm_entity($cdmEntity)) {
2115
    return "cdm:" . $cdmEntity->class . " uuid:" . $cdmEntity->uuid;
2121
    $attributes =  "cdm:" . $cdmEntity->class . " uuid:" . $cdmEntity->uuid;
2122
  }
2123
  if($cdmEntity->class == 'TaxonNodeDto'){
2124
    $attributes .= " taxon_uuid:"  . $cdmEntity->taxonUuid . " sec_uuid:"  . $cdmEntity->secUuid;;
2125
  }
2126
  if($cdmEntity->class == 'Taxon' && isset($cdmEntity->sec->uuid)){
2127
    $attributes .= " sec_uuid:"  . $cdmEntity->sec->uuid;
2116 2128
  }
2129
  return $attributes;
2117 2130
}
2118 2131

  
2119 2132

  
modules/cdm_dataportal/cdm_taxontree/cdm_taxontree.module
1024 1024
  }
1025 1025

  
1026 1026
  // Taxon name.
1027
  $out .= $name;
1027
  $out .= '<span class="' . html_class_attribute_ref($node) . '">' . $name . '</span>';
1028 1028

  
1029 1029
  // Concept_switch or other theme callbacks.
1030 1030
  if ($tree_node_callback) {
modules/cdm_dataportal/includes/pages.inc
1020 1020
        ($is_first_item ? '' : ' ')
1021 1021
        . $rank_separator
1022 1022
        . l(
1023
          $node_name,
1023
          '<span class="' . html_class_attribute_ref($node) . '">' . $node_name . '</span>',
1024 1024
          $path,
1025 1025
          array(
1026 1026
            'attributes' => array(
......
1028 1028
              'data-cdm-taxon-uuid' => array($node->taxonUuid),
1029 1029
              'data-cdm-classification-mode' => array('siblings'),
1030 1030
              'data-cdm-align-with' => array('prev')
1031
            )
1031
            ),
1032
            'html' => true
1032 1033
          )
1033 1034
        );
1034 1035
      }

Also available in: Unified diff