tripal_genetic.module 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions needed for this drupal module.
  5. * The drupal tripal_genetic module maps directly to the chado X module.
  6. *
  7. * For documentation regarding the Chado X module:
  8. * @see http://gmod.org/wiki/Chado_General_Module
  9. */
  10. require('api/tripal_genetic.api.inc');
  11. require('includes/tripal_genetic.schema.inc');
  12. /*************************************************************************
  13. * Implements hook_views_api()
  14. * Purpose: Essentially this hook tells drupal that there is views support for
  15. * for this module which then includes tripal_genetic.views.inc where all the
  16. * views integration code is
  17. */
  18. function tripal_genetic_views_api() {
  19. return array(
  20. 'api' => 2.0,
  21. );
  22. }
  23. /*
  24. *
  25. */
  26. function tripal_genetic_theme() {
  27. return array(
  28. 'tripal_feature_genotypes' => array(
  29. 'arguments' => array('node' => NULL),
  30. 'template' => 'tripal_feature_genotypes',
  31. ),
  32. );
  33. }
  34. /**
  35. *
  36. */
  37. function tripal_genetic_nodeapi(&$node, $op, $teaser, $page) {
  38. switch ($op) {
  39. case 'view':
  40. if ($node->type == 'chado_feature') {
  41. // the tripal_natural_diversity module provides a tripal_feature_nd_genotype
  42. // template. The only difference between them is the addition of
  43. // project information by this ND module's template. Therefore,
  44. // if the tripal_natural_diversity content is present then don't add the
  45. // template from this module as the ND module would superceed this.
  46. if (!array_key_exists('tripal_feature_nd_genotypes', $node->content)) {
  47. $node->content['tripal_feature_genotypes'] = array(
  48. '#value' => theme('tripal_feature_genotypes', $node),
  49. );
  50. }
  51. }
  52. }
  53. }