Project

General

Profile

« Previous | Next » 

Revision 0820cdc0

Added by Andreas Kohlbecker over 5 years ago

ref #2985 output of extensions implemented generically and for occurrences

View differences:

modules/cdm_dataportal/includes/common.inc
315 315
  static $default_unit = 'm';
316 316

  
317 317
  $min_max_array = min_max_array();
318
  if (is_numeric($object->$field_base_name)) {
318
  if (@is_numeric($object->$field_base_name)) {
319 319
    $min_max_array['Min'] = new stdClass();
320 320
    $min_max_array['Min']->_value = $object->$field_base_name;
321 321
  }
322 322

  
323 323
  $field_name = $field_base_name . 'Max';
324
  if (is_numeric($object->$field_name)) {
324
  if (@is_numeric($object->$field_name)) {
325 325
    $min_max_array['Max'] = new stdClass();
326 326
    $min_max_array['Max']->_value = $object->$field_name;
327 327
  }
328 328
  $min_max_markup = min_max_markup($min_max_array, $default_unit);
329 329

  
330 330
  $field_name = $field_base_name . 'Error';
331
  if (is_numeric($object->$field_name )) {
331
  if (@is_numeric($object->$field_name )) {
332 332
    $min_max_markup .= ' +/- ' . $object->$field_name . ' ' . $default_unit;
333 333
  }
334 334
  $field_name = $field_base_name . 'Text';
335
  if (is_string($object->$field_name)) {
335
  if (@is_string($object->$field_name)) {
336 336
    $min_max_markup .= ' ' . $object->$field_name;
337 337
  }
338 338
  return $min_max_markup;
......
509 509

  
510 510
  $groups = array();
511 511

  
512
  $contact_details = null;
513

  
512 514
  $label_suffix = ':';
513 515

  
514 516
  $contact_field_names_map = array(
......
550 552
  return array($contact_details);
551 553

  
552 554
}
555

  
556
/**
557
 * Compose an render array from a CDM Extension objects.
558
 *
559
 * @param $extensions
560
 *    An array of CDM Extension objects
561
 * @return array
562
 *   A render array containing the fields of the supplied $sequence
563
 *
564
 * @ingroup compose
565
 */
566
function compose_extensions($extensions)
567
{
568
  $extensions_render_array= null;
569
  $extensions_by_type = array();
570
  foreach ($extensions as $extension) {
571
    if (@is_string($extension->value)) {
572
      if (!isset($extensions_by_type[$extension->type->representation_L10n])) {
573
        $extensions_by_type[$extension->type->representation_L10n] = array();
574
      }
575
      $extensions_by_type[$extension->type->representation_L10n][] = markup_to_render_array($extension->value);
576
    }
577
  }
578

  
579
  if (count($extensions_by_type)) {
580
    $sub_dl_groups = array();
581
    foreach ($extensions_by_type as $type_label => $text_list) {
582
      @_description_list_group_add($sub_dl_groups, $type_label . ':', $text_list);
583
    }
584
    $extensions_render_array = array(
585
      array('#theme' => 'description_list', '#groups' => $sub_dl_groups)
586
    );
587
    return $extensions_render_array;
588
  }
589
  return $extensions_render_array;
590
}

Also available in: Unified diff