tripal_featuremap_base.tpl.php

  1. 2.x tripal_featuremap/theme/templates/tripal_featuremap_base.tpl.php
  2. 3.x legacy/tripal_featuremap/theme/templates/tripal_featuremap_base.tpl.php
1 theme call to tripal_featuremap_base.tpl.php
tripal_featuremap_node_view in tripal_featuremap/includes/tripal_featuremap.chado_node.inc
Implements hook_node_view(). Acts on all content types.

File

tripal_featuremap/theme/templates/tripal_featuremap_base.tpl.php
View source
  1. <?php
  2. $featuremap = $variables['node']->featuremap;
  3. // expand the description field
  4. $featuremap = chado_expand_var($featuremap, 'field', 'featuremap.description'); ?>
  5. <div class="tripal_featuremap-data-block-desc tripal-data-block-desc"></div> <?php
  6. // the $headers array is an array of fields to use as the colum headers.
  7. // additional documentation can be found here
  8. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  9. // This table for the analysis has a vertical header (down the first column)
  10. // so we do not provide headers here, but specify them in the $rows array below.
  11. $headers = array();
  12. // the $rows array contains an array of rows where each row is an array
  13. // of values for each column of the table in that row. Additional documentation
  14. // can be found here:
  15. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  16. $rows = array();
  17. // Map Name row
  18. $rows[] = array(
  19. array(
  20. 'data' => 'Map Name',
  21. 'header' => TRUE,
  22. 'width' => '20%',
  23. ),
  24. $featuremap->name
  25. );
  26. // Map Units
  27. $rows[] = array(
  28. array(
  29. 'data' => 'Map Units',
  30. 'header' => TRUE
  31. ),
  32. $featuremap->unittype_id->name
  33. );
  34. // allow site admins to see the feature ID
  35. if (user_access('view ids')) {
  36. // Feature Map ID
  37. $rows[] = array(
  38. array(
  39. 'data' => 'Feature Map ID',
  40. 'header' => TRUE,
  41. 'class' => 'tripal-site-admin-only-table-row',
  42. ),
  43. array(
  44. 'data' => $featuremap->featuremap_id,
  45. 'class' => 'tripal-site-admin-only-table-row',
  46. ),
  47. );
  48. }
  49. // the $table array contains the headers and rows array as well as other
  50. // options for controlling the display of the table. Additional
  51. // documentation can be found here:
  52. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  53. $table = array(
  54. 'header' => $headers,
  55. 'rows' => $rows,
  56. 'attributes' => array(
  57. 'id' => 'tripal_featuremap-table-base',
  58. 'class' => 'tripal-data-table'
  59. ),
  60. 'sticky' => FALSE,
  61. 'caption' => '',
  62. 'colgroups' => array(),
  63. 'empty' => '',
  64. );
  65. // once we have our table array structure defined, we call Drupal's theme_table()
  66. // function to generate the table.
  67. print theme_table($table);
  68. if (property_exists($featuremap, 'description')) { ?>
  69. <div style="text-align: justify"><?php print $featuremap->description; ?></div> <?php
  70. }