Project

General

Profile

Revision 834f548a

ID834f548afda8b59aa02d6698656d90280f9a2a2b
Parent 358e0b7f
Child a2b8e113

Added by Andreas Kohlbecker 7 months ago

ref #8759 conditionally supressing state 'present' in description string representations

View differences:

modules/cdm_dataportal/includes/descriptions.inc
2146 2146
            case 'CategoricalData':
2147 2147
              $state_data = render_state_data($element);
2148 2148
              if (!empty($state_data)) {
2149
                $description_strings[] = '<span class="'. html_class_attribute_ref($element) .'"><span class="label">' . $feature_label . '</span>: ' . $state_data . '</span>';
2149
                if(is_suppress_state_present_display($element, $root_node)){
2150
                  $description_strings[] = '<span class="'. html_class_attribute_ref($element) .'"><span class="label">' . $feature_label . '</span>: '  . '</span>';
2151
                } else {
2152
                  $description_strings[] = '<span class="'. html_class_attribute_ref($element) .'"><span class="label">' . $feature_label . '</span>: ' . $state_data . '</span>;' ;
2153
                }
2150 2154
              }
2151 2155
              break;
2152 2156
            case 'QuantitativeData':
2153
              $description_strings[] = '<span class="'. html_class_attribute_ref($element) .'"><span class="label">' . $feature_label . '</span>: ' . render_quantitative_statistics($element) . '</span>';
2157
              $description_strings[] = '<span class="'. html_class_attribute_ref($element) .'"><span class="label">' . $feature_label . '</span>: ' . render_quantitative_statistics($element) . '</span>;';
2154 2158
              break;
2155 2159
          }
2156 2160
        }
......
2163 2167
        $description_strings[] = $child_markup;
2164 2168
      }
2165 2169
    }
2166
    $out  = join($description_strings,  '; ');
2170
    if(count($description_strings) > 0){
2171
      // remove last semicolon
2172
      $description_strings[count($description_strings) - 1] = preg_replace('/;$/', '', $description_strings[count($description_strings) - 1]);
2173
    }
2174
    $out  = join($description_strings,  ' ');
2167 2175
  }
2168 2176
  return $out;
2169 2177
}
......
2406 2414
          case 'CategoricalData':
2407 2415
            default:
2408 2416
            if (!empty($element->stateData)) {
2409
              $supress_state_display = count($element->stateData) == 1 & $element->stateData[0]->state->representation_L10n == 'present' && is_array($root_node->childNodes);
2417
              $supress_state_display = is_suppress_state_present_display($element, $root_node);
2410 2418
              if(!$supress_state_display){
2411 2419
                $state_cell = render_state_data($element);
2412 2420
              } else {
......
2433 2441
  return $row_items;
2434 2442
}
2435 2443

  
2444
/**
2445
 * @param $element
2446
 * @param $root_node
2447
 *
2448
 * @return bool
2449
 */
2450
function is_suppress_state_present_display($element, $root_node) {
2451
  return count($element->stateData) == 1 & $element->stateData[0]->state->representation_L10n == 'present' && is_array($root_node->childNodes);
2452
}
2453

  
2436 2454

  
2437 2455

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)