Project

General

Profile

« Previous | Next » 

Revision 47420a9f

Added by Andreas Kohlbecker about 3 years ago

ref #7599 ref #6866 more specimen details tables - tables may span multiple grid colums

View differences:

modules/cdm_dataportal/includes/occurrences_new.inc
408 408
      render_specimen_typedesignation_dto($unit_dto->specimenTypeDesignations));
409 409
  }
410 410

  
411
  return cdm_sob_dto_table(t('Type designations'), $table_row_data, $unit_dto, 5);
411
  return cdm_sob_dto_table(t('Type designations'), $table_row_data, $unit_dto, 5, 2);
412 412
}
413 413

  
414 414
/**
......
479 479
    'showCaption' => true
480 480
  ));
481 481
  $table_row_data[] = cdm_sob_dto_table_row(NULL, $gallery_markup);
482
  return cdm_sob_dto_table(t($heading), $table_row_data, $sob_dto, 20);
482
  $grid_col_span = count($listOfMedia) > 1 ? 2 : NULL;
483
  return cdm_sob_dto_table(t($heading), $table_row_data, $sob_dto, 20, $grid_col_span);
483 484
}
484 485

  
485 486
/**
......
527 528
 * @param $sob_dto
528 529
 * @param $weight
529 530
 *  The weight determining the order of the drupal render element
531
 * @param $grid_col_span
532
 *  The number of grid colums the table should
530 533
 *
531 534
 * @return array|null
532 535
 */
533
function cdm_sob_dto_table($table_heading, array $table_row_data, $sob_dto, $weight = NULL) {
536
function cdm_sob_dto_table($table_heading, array $table_row_data, $sob_dto, $weight = NULL, $grid_col_span = 1) {
534 537
  if (count($table_row_data) > 0) {
538
    $wrapper_style = '';
539
    if($grid_col_span > 1){
540
      $wrapper_style = ' style="grid-column-start: span ' . $grid_col_span. ';"';
541
    }
535 542
    $sob_table = [
536 543
      '#theme' => 'table',
537
      '#prefix' => '<div class="table-wrapper">',
544
      '#prefix' => '<div class="table-wrapper"' . $wrapper_style . '>',
538 545
      '#suffix' => '</div>',
539 546
      '#header' => [
540 547
        [
......
546 553
      "#attributes" => [
547 554
        "class" => [
548 555
          'specimen-or-observation-details',
549
          html_class_attribute_ref($sob_dto),
556
          html_class_attribute_ref($sob_dto)
550 557
        ],
551 558
      ],
552 559
    ];

Also available in: Unified diff