Project

General

Profile

« Previous | Next » 

Revision f6ff2764

Added by Andreas Kohlbecker about 3 years ago

ref #6866 using details grid for specimen page

View differences:

modules/cdm_dataportal/includes/pages.inc
1100 1100

  
1101 1101
/**
1102 1102
 *
1103
 * @param $specimen_or_observation
1104
 *   A CDM SpecimenOrObservation entity
1103
 * @param $sob_dto
1104
 *   A SpecimenOrObservationDTO
1105 1105
 *
1106 1106
 * @return array
1107 1107
 *    The drupal render array for the page
1108 1108
 *
1109 1109
 * @ingroup compose
1110 1110
 */
1111
function compose_cdm_specimen_page($specimen_or_observation)
1111
function compose_cdm_specimen_page($sob_dto)
1112 1112
{
1113
  drupal_set_title("Specimen Details");
1113
  drupal_set_title($sob_dto->label);
1114 1114
  RenderHints::pushToRenderStack('specimen_page');
1115 1115

  
1116
  $specimen_table = array(
1117
      '#theme' => 'table',
1118
      '#weight' => 2,
1119
      // prefix attributes and rows with '#' to let it pass to the theme function,
1120
      // otherwise it is handled as child render array
1121

  
1122
    '#attributes' => array('class' => 'specimens'),
1123
      '#rows' => array(),
1124
      '#prefix' => '<div id="specimens">',
1125
      '#suffix' => '</div>',
1126

  
1127

  
1128
  );
1129
  $specimen_markup = compose_cdm_specimen_or_observation($specimen_or_observation, true);
1130

  
1131
  $specimen_table['#rows'][] = array(
1132
          // An array of table rows. Every row is an array of cells, or an associative array
1133
          'data' => $specimen_markup,
1134
          'class' =>  array(
1135
              'descriptionElement',
1136
              'descriptionElement_IndividualsAssociation'
1137
          ),
1138
  );
1139

  
1140
  $render_array['specimen_table'] =  $specimen_table;
1116
  $specimen_render_array = compose_cdm_specimen_or_observation_new($sob_dto);
1117
  $render_array['specimen_or_observation_detail'] = [
1118
    '#type' => 'container',
1119
    '#attributes' => [
1120
      'class' => 'derived-unit-details-grid'
1121
    ],
1122
    'children' => $specimen_render_array
1123
    ];
1141 1124

  
1142 1125
  RenderHints::popFromRenderStack();
1143
  return $specimen_markup; // $render_array;
1126
  return $render_array;
1144 1127
}
1145 1128

  
1146 1129
/**
......
1406 1389
 *  Returns HTML for the default title of a specimen page.
1407 1390
 *  The returned title is a the identifier of the specimen.
1408 1391
 *
1409
 * @param object $occurrence
1410
 *  The CDM SpecimenOrObservation instance
1411
 *     being formatted for the title.
1392
 * @param object $sob_dto
1393
 *  A SpecimenOrObservationDTO to create a tile string for.
1412 1394
 *
1413 1395
 * @return string
1414 1396
 *  Markup for the title of a specimen page
1415 1397
 */
1416
function render_specimen_page_title($occurrence)
1398
function render_specimen_page_title($sob_dto)
1417 1399
{
1418 1400
  RenderHints::pushToRenderStack('render_specimen_page_title');
1419 1401
  $out = '';
1420
  list($specimenID, $collection) = specimen_id_and_collection_for($occurrence);
1421
  if ($occurrence->class == 'FieldUnit'){
1402
  if ($sob_dto->type == 'FieldUnit'){
1422 1403
    $out .= '<span class="type-label">Field unit: </span>';
1423 1404
  }else{
1424 1405
    $out .= '<span class="type-label">Specimen:  </span>';
1406
    $out .= $sob_dto->specimenIdentifier;
1425 1407
  }
1426

  
1427
  if($collection){
1428
    $out .= $collection." ";
1429
  }
1430
  $out .= $specimenID;
1431

  
1432 1408
  RenderHints::popFromRenderStack();
1433 1409

  
1434
  return '<span class="' . $occurrence->class . '">' . $out . '</span>';
1410
  return '<span class="' . html_class_attribute_ref($sob_dto) . '">' . $out . '</span>';
1435 1411
}
1436 1412

  
1437 1413
/**

Also available in: Unified diff