tripal_genetic.module

  1. 2.x tripal_genetic/tripal_genetic.module
  2. 3.x legacy/tripal_genetic/tripal_genetic.module
  3. 1.x tripal_genetic/tripal_genetic.module

This file contains the basic functions needed for this drupal module. The drupal tripal_genetic module maps directly to the chado X module.

For documentation regarding the Chado X module:

tripal_genetic Genetic Module

See also

http://gmod.org/wiki/Chado_General_Module

File

tripal_genetic/tripal_genetic.module
View source
  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. * @defgroup tripal_genetic Genetic Module
  11. * @ingroup tripal_modules
  12. */
  13. require('api/tripal_genetic.api.inc');
  14. require('includes/tripal_genetic.schema.inc');
  15. /*************************************************************************
  16. * Implements hook_views_api()
  17. * Purpose: Essentially this hook tells drupal that there is views support for
  18. * for this module which then includes tripal_genetic.views.inc where all the
  19. * views integration code is
  20. *
  21. * @ingroup tripal_genetic
  22. */
  23. function tripal_genetic_views_api() {
  24. return array(
  25. 'api' => 2.0,
  26. );
  27. }
  28. /**
  29. * Implements hook_theme().
  30. *
  31. * @ingroup tripal_genetic
  32. */
  33. function tripal_genetic_theme() {
  34. return array(
  35. 'tripal_feature_genotypes' => array(
  36. 'arguments' => array('node' => NULL),
  37. 'template' => 'tripal_feature_genotypes',
  38. ),
  39. 'tripal_stock_genotypes' => array(
  40. 'arguments' => array('node' => NULL),
  41. 'template' => 'tripal_stock_genotypes',
  42. ),
  43. );
  44. }
  45. /**
  46. * Implements hook_nodeapi().
  47. *
  48. * @ingroup tripal_genetic
  49. */
  50. function tripal_genetic_nodeapi(&$node, $op, $teaser, $page) {
  51. switch ($op) {
  52. case 'view':
  53. if ($node->type == 'chado_feature') {
  54. // the tripal_natural_diversity module provides a tripal_feature_nd_genotype
  55. // template. The only difference between them is the addition of
  56. // project information by this ND module's template. Therefore,
  57. // if the tripal_natural_diversity content is present then don't add the
  58. // template from this module as the ND module would superceed this.
  59. if (!array_key_exists('tripal_feature_nd_genotypes', $node->content)) {
  60. $node->content['tripal_feature_genotypes'] = array(
  61. '#value' => theme('tripal_feature_genotypes', $node),
  62. );
  63. }
  64. }
  65. if ($node->type == 'chado_stock') {
  66. // the tripal_natural_diversity module provides a tripal_stock_nd_genotype
  67. // template. The only difference between them is the addition of
  68. // project information by this ND module's template. Therefore,
  69. // if the tripal_natural_diversity content is present then don't add the
  70. // template from this module as the ND module would superceed this.
  71. if (!array_key_exists('tripal_stock_nd_genotypes', $node->content)) {
  72. $node->content['tripal_stock_genotypes'] = array(
  73. '#value' => theme('tripal_stock_genotypes', $node),
  74. );
  75. }
  76. }
  77. break;
  78. }
  79. }

Related topics