tripal_library_synonyms.tpl.php

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

File

legacy/tripal_library/theme/templates/tripal_library_synonyms.tpl.php
View source
  1. <?php
  2. $library = $variables['node']->library;
  3. // expand the library object to include the synonyms from the library_synonym
  4. // table in chado.
  5. $options = array('return_array' => 1);
  6. $library = chado_expand_var($library, 'table', 'library_synonym', $options);
  7. $synonyms = $library->library_synonym;
  8. if(count($synonyms) > 0){ ?>
  9. <div class="tripal_library-data-block-desc tripal-data-block-desc">The library '<?php print $library->name ?>' has the following synonyms</div><?php
  10. // the $headers array is an array of fields to use as the colum headers.
  11. // additional documentation can be found here
  12. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  13. // This table for the analysis has a vertical header (down the first column)
  14. // so we do not provide headers here, but specify them in the $rows array below.
  15. $headers = array('Synonym');
  16. // the $rows array contains an array of rows where each row is an array
  17. // of values for each column of the table in that row. Additional documentation
  18. // can be found here:
  19. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  20. $rows = array();
  21. foreach ($synonyms as $library_synonym){
  22. $rows[] = array(
  23. $library_synonym->synonym_id->name
  24. );
  25. }
  26. // the $table array contains the headers and rows array as well as other
  27. // options for controlling the display of the table. Additional
  28. // documentation can be found here:
  29. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  30. $table = array(
  31. 'header' => $headers,
  32. 'rows' => $rows,
  33. 'attributes' => array(
  34. 'id' => 'tripal_library-table-synonyms',
  35. 'class' => 'tripal-data-table'
  36. ),
  37. 'sticky' => FALSE,
  38. 'caption' => '',
  39. 'colgroups' => array(),
  40. 'empty' => '',
  41. );
  42. // once we have our table array structure defined, we call Drupal's theme_table()
  43. // function to generate the table.
  44. print theme_table($table);
  45. }