tripal_phylogeny_base.tpl.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. $phylotree = $variables['node']->phylotree;
  3. $phylotree = chado_expand_var($phylotree, 'field', 'phylotree.comment'); ?>
  4. <div class="tripal_phylogeny-data-block-desc tripal-data-block-desc"> <?php
  5. // the $headers array is an array of fields to use as the colum headers.
  6. // additional documentation can be found here
  7. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  8. // This table for the analysis has a vertical header (down the first column)
  9. // so we do not provide headers here, but specify them in the $rows array below.
  10. $headers = [];
  11. // the $rows array contains an array of rows where each row is an array
  12. // of values for each column of the table in that row. Additional documentation
  13. // can be found here:
  14. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  15. $rows = [];
  16. // Name row
  17. $rows[] = [
  18. [
  19. 'data' => 'Tree Name',
  20. 'header' => TRUE,
  21. ],
  22. $phylotree->name,
  23. ];
  24. $leaf_type = 'N/A';
  25. if ($phylotree->type_id) {
  26. $leaf_type = $phylotree->type_id->name;
  27. }
  28. $rows[] = [
  29. [
  30. 'data' => 'Leaf type',
  31. 'header' => TRUE,
  32. ],
  33. $leaf_type,
  34. ];
  35. $description = 'N/A';
  36. if ($phylotree->comment) {
  37. $description = $phylotree->comment;
  38. }
  39. $rows[] = [
  40. [
  41. 'data' => 'Description',
  42. 'header' => TRUE,
  43. ],
  44. $description,
  45. ];
  46. // the $table array contains the headers and rows array as well as other
  47. // options for controlling the display of the table. Additional
  48. // documentation can be found here:
  49. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  50. $table = [
  51. 'header' => $headers,
  52. 'rows' => $rows,
  53. 'attributes' => [
  54. 'id' => 'tripal_phylogeny-table-base',
  55. 'class' => 'tripal-data-table',
  56. ],
  57. 'sticky' => FALSE,
  58. 'caption' => '',
  59. 'colgroups' => [],
  60. 'empty' => '',
  61. ];
  62. // once we have our table array structure defined, we call Drupal's theme_table()
  63. // function to generate the table.
  64. print theme_table($table);