function tripal_library_nodeapi

1.x tripal_library.module tripal_library_nodeapi(&$node, $op, $teaser, $page)

Implementation of hook_nodeapi(). Display library information for associated features or organisms This function also provides contents for indexing

Related topics

File

tripal_library/tripal_library.module, line 178

Code

function tripal_library_nodeapi(&$node, $op, $teaser, $page) {

  switch ($op) {
    // Note that this function only adds library view to an organism/feature
    // node.
    case 'view':
      // add the library to the organism/feature search indexing
      if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
        $node->content['tripal_library_index_version'] = array(
          '#value' => theme('tripal_library_search_index', $node),
        );
      }
      elseif ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
        $node->content['tripal_library_index_version'] = array(
          '#value' => theme('tripal_library_search_result', $node),
        );
      }
      else {
        switch ($node->type) {
          case 'chado_organism':
            // Show library if the organism/feature is not at teaser view
            $node->content['tripal_organism_libraries'] = array(
              '#value' => theme('tripal_organism_libraries', $node),
            );
            break;
          case 'chado_feature':
            // Show library if the organism/feature is not at teaser view
            $node->content['tripal_feature_libraries'] = array(
              '#value' => theme('tripal_feature_libraries', $node),
            );
            break;
        }
      }
      break;
  }
}