function tripal_genetic_node_view

2.x tripal_genetic.module tripal_genetic_node_view($node, $view_mode, $langcode)
3.x tripal_genetic.module tripal_genetic_node_view($node, $view_mode, $langcode)

Implements hook_node_view(). Acts on all content types

Related topics

File

tripal_genetic/tripal_genetic.module, line 142
Basic functionality for the genetic

Code

function tripal_genetic_node_view($node, $view_mode, $langcode) {

  if ($node->type == 'chado_feature') {
    if ($view_mode == 'full') {
      // the tripal_natural_diversity module provides a tripal_feature_nd_genotype
      // template.  The ND template superceeds this one. Therefore,
      // if the tripal_natural_diversity content is present then don't add the
      // template from this module as the ND module would superceed this.
      if (!array_key_exists('tripal_feature_nd_genotypes', $node->content)) {
        $node->content['tripal_feature_genotypes'] = array(
          '#theme' => 'tripal_feature_genotypes',
          '#node' => $node,
          '#tripal_toc_id' => 'genotypes',
          '#tripal_toc_title' => 'Genotypes',
        );
      }
    }
  }
  if ($node->type == 'chado_stock') {
    if ($view_mode == 'full') {
      // the tripal_natural_diversity module provides a tripal_stock_nd_genotype
      // template.  The ND template superceeds this one. Therefore,
      // if the tripal_natural_diversity content is present then don't add the
      // template from this module as the ND module would superceed this.
      if (!array_key_exists('tripal_stock_nd_genotypes', $node->content)) {
        $node->content['tripal_stock_genotypes'] = array(
          '#theme' => 'tripal_stock_genotypes',
          '#node' => $node,
          '#tripal_toc_id' => 'genotypes',
          '#tripal_toc_title' => 'Genotypes',
        );
      }
    }
  }
}