function tripal_natural_diversity_node_view

2.x tripal_natural_diversity.module tripal_natural_diversity_node_view($node, $view_mode, $langcode)
3.x tripal_natural_diversity.module tripal_natural_diversity_node_view($node, $view_mode, $langcode)

Implements hook_node_view(). Acts on all content types.

Related topics

File

tripal_natural_diversity/tripal_natural_diversity.module, line 134
Basic function for the natural diversity module

Code

function tripal_natural_diversity_node_view($node, $view_mode, $langcode) {
  switch ($node->type) {
    case 'chado_feature':
      if ($view_mode == 'full') {
        // the tripal_genetic module provides a tripal_feature_genotype
        // template. if the tripal_genetic content is present get rid of it as this
        // module superceeds it.
        if (array_key_exists('tripal_feature_genotypes', $node->content)) {
          unset($node->content['tripal_feature_genotypes']);
        }
        $node->content['tripal_feature_nd_genotypes'] = array(
          '#theme' => 'tripal_feature_nd_genotypes',
          '#node' => $node,
          '#tripal_toc_id' => 'genotypes',
          '#tripal_toc_title' => 'Genotypes',
        );
      }
      break;
    case 'chado_stock':
      if ($view_mode == 'full') {
        // the tripal_genetic module provides a tripal_stock_genotype
        // template. if the tripal_genetic content is present get rid of it as this
        // module superceeds it.
        if (array_key_exists('tripal_stock_genotypes', $node->content)) {
          unset($node->content['tripal_stock_genotypes']);
        }
        $node->content['tripal_stock_nd_genotypes'] = array(
          '#theme' => 'tripal_stock_nd_genotypes',
          '#node' => $node,
          '#tripal_toc_id' => 'genotypes',
          '#tripal_toc_title' => 'Genotypes',
        );
        $node->content['tripal_stock_nd_phenotypes'] = array(
          '#theme' => 'tripal_stock_nd_phenotypes',
          '#node' => $node,
          '#tripal_toc_id' => 'phenotypes',
          '#tripal_toc_title' => 'Phenotypes',
        );
      }
      break;
  }
}