tripal_example.chado_node.inc 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. <?php
  2. /**
  3. * @file
  4. * This file should contain all Drupal hooks for interacting with nodes.
  5. *
  6. */
  7. /**
  8. * Implementation of hook_node_info(). This hook provides information to drupal
  9. * about any node types that are being created by this module. If your module
  10. * does not create any node types then this function is not required.
  11. *
  12. * @ingroup tripal_example
  13. */
  14. function tripal_example_node_info() {
  15. $nodes = array();
  16. //$nodes['chado_example'] = array(
  17. // 'name' => t('example'),
  18. // 'base' => 'chado_example',
  19. // 'description' => t('A example from the chado database'),
  20. // 'title_label' => t('example'),
  21. // 'has_title' => FALSE,
  22. // 'has_body' => FALSE,
  23. // 'locked' => TRUE
  24. // This section of the node type array specifies how Tripal will sync the node
  25. // types with data in Chado. When Drupal creates a node it has no way of
  26. // coordinating which node belongs to which record in Chado. Therefore,
  27. // Tripal maintains tables in the Drupal schema that maps Drupal nodes
  28. // to recrords in Chado. Syncing is the process of creating Drupal nodes
  29. // and linking them to the appropriate record.
  30. // 'chado_node_api' => array(
  31. // 'base_table' => 'example', // the base table name (e.g. feature, library, contact)
  32. // 'hook_prefix' => 'chado_example',// the node type hook prefix
  33. // 'record_type_title' => array(
  34. // 'singular' => t('Library'), // how to refer to the record
  35. // 'plural' => t('Libraries') // how to refer to the record in plurals
  36. // ),
  37. // 'sync_filters' => array(
  38. // 'type_id' => TRUE, // if the record has a type_id set to TRUE
  39. // 'organism_id' => TRUE // if the record has an organism_id set to TRUE
  40. // ),
  41. // )
  42. //);
  43. return $nodes;
  44. }
  45. /**
  46. * Implement hook_access(). This hook provides instructions to
  47. * drupal for which users can access the custom content types
  48. * created in the function above. The available permissions
  49. * are set in the chado_example_permissions() hook in the
  50. * tripal_example.module file. This hook is not needed
  51. * if no node types were defined in the hook_node_info() hook.
  52. *
  53. * @return
  54. * This function should return null if it does not specificially
  55. * deny access. This allows for other mechanisms to to deny
  56. * or reject access. If the return value is TRUE then access
  57. * is granted regardless of any other rules that might be implemented
  58. * by other modules.
  59. */
  60. function chado_example_node_access($node, $op, $account) {
  61. if ($op == 'create') {
  62. if (!user_access('create chado_example content', $account)) {
  63. return FALSE;
  64. }
  65. return TRUE;
  66. }
  67. if ($op == 'update') {
  68. if (!user_access('edit chado_example content', $account)) {
  69. return FALSE;
  70. }
  71. }
  72. if ($op == 'delete') {
  73. if (!user_access('delete chado_example content', $account)) {
  74. return FALSE;
  75. }
  76. }
  77. if ($op == 'view') {
  78. if (!user_access('access chado_example content', $account)) {
  79. return FALSE;
  80. }
  81. }
  82. return NULL;
  83. }
  84. /**
  85. * Implementation of hook_form() when a node type of chado_example is defined.
  86. * If a node type is not defined then this function is not needed. The table
  87. * name in chado for this example module is named 'example' so there is a
  88. * corresponding example_id in that table (similar to feature.feature_id,
  89. * contact.contact_id, etc).
  90. *
  91. * @ingroup tripal_example
  92. */
  93. function chado_example_form($node, &$form_state) {
  94. $form = array();
  95. // Default values can come in the following ways:
  96. //
  97. // 1) as elements of the $node object. This occurs when editing an existing example
  98. // 2) in the $form_state['values'] array which occurs on a failed validation or
  99. // ajax callbacks from non submit form elements
  100. // 3) in the $form_state['input'[ array which occurs on ajax callbacks from submit
  101. // form elements and the form is being rebuilt
  102. //
  103. // set form field defaults
  104. // if we are editing an existing node then the example is already part of the node
  105. if (property_exists($node, 'example')) {
  106. // $example = $node->example;
  107. // $example = chado_expand_var($example, 'field', 'example.residues');
  108. // $example_id = $example->example_id;
  109. // $uniquename = $example->uniquename;
  110. // keep track of the example id
  111. //$form['example_id'] = array(
  112. // '#type' => 'value',
  113. // '#value' => $example_id,
  114. //);
  115. }
  116. // if we are re constructing the form from a failed validation or ajax callback
  117. // then use the $form_state['values'] values
  118. if (array_key_exists('values', $form_state)) {
  119. // $uniquename = $form_state['values']['uniquename'];
  120. }
  121. // if we are re building the form from after submission (from ajax call) then
  122. // the values are in the $form_state['input'] array
  123. if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
  124. // $uniquename = $form_state['input']['uniquename'];
  125. }
  126. // add form elements here.
  127. // PROPERTIES FORM
  128. //---------------------------------------------
  129. // If there is a exampleprop table and you want to allow users to add/remove entries
  130. // from it through your node form then add this section to your own node form
  131. $details = array(
  132. 'property_table' => 'exampleprop', // the name of the prop table
  133. 'base_foreign_key' => 'example_id', // the name of the key in your base chado table
  134. 'base_key_value' => $example_id, // the value of example_id for this record
  135. 'cv_name' => 'example_property_types' // the cv.name of the cv governing exampleprop.type_id
  136. );
  137. // Adds the form elements to your current form
  138. chado_add_node_form_properties($form, $form_state, $details);
  139. // ADDITIONAL DBXREFS FORM
  140. //---------------------------------------------
  141. // If there is a example_dbxref table and you want to allow users to add/remove entries
  142. // from it through your node form then add this section to your own node form
  143. $details = array(
  144. 'linking_table' => 'example_dbxref', // the name of the _dbxref table
  145. 'base_foreign_key' => 'example_id', // the name of the key in your base chado table
  146. 'base_key_value' => $example_id // the value of example_id for this record
  147. );
  148. // Adds the form elements to your current form
  149. chado_add_node_form_dbxrefs($form, $form_state, $details);
  150. // RELATIONSHIPS FORM
  151. //---------------------------------------------
  152. // If there is a example_relationship table and you want to allow users to add/remove entries
  153. // from it through your node form then add this section to your own node form
  154. $details = array(
  155. 'relationship_table' => 'example_relationship', // the name of the _relationship table
  156. 'base_table' => 'example', // the name of your chado base table
  157. 'base_foreign_key' => 'example_id', // the name of the key in your base chado table
  158. 'base_key_value' => $example_id, // the value of example_id for this record
  159. 'nodetype' => 'example', // the human-readable name of your node type
  160. 'cv_name' => 'example_relationship_types' // the cv.name of the cv governing example_relationship.type_id
  161. );
  162. // Adds the form elements to your current form
  163. chado_add_node_form_relationships($form, $form_state, $details);
  164. // return the form
  165. return $form;
  166. }
  167. /**
  168. * Implementation of hook_validate
  169. *
  170. * This validation is being used for three activities:
  171. * CASE A: Update a node that exists in both drupal and chado
  172. * CASE B: Synchronizing a node from chado to drupal
  173. * CASE C: Inserting a new node that exists in niether drupal nor chado
  174. *
  175. * @param $node
  176. *
  177. *
  178. * @ingroup tripal_example
  179. */
  180. function chado_example_validate($node, $form, &$form_state) {
  181. // be sure to always trim text fields
  182. // $node->uniquename = trim($node->uniquename);
  183. // if this is a delete then don't validate
  184. if($node->op == 'Delete') {
  185. return;
  186. }
  187. // we are syncing if we do not have a node ID but we do have a example_id. We don't
  188. // need to validate during syncing so just skip it.
  189. if (is_null($node->nid) and property_exists($node, 'example_id') and $node->example_id != 0) {
  190. return;
  191. }
  192. // Validating for an update. If the 'nid' property is present in the node then
  193. // this is an update and validation can be different for updates
  194. if (property_exists($node, 'nid')) {
  195. // if there is a problem with a field then you can set an error on the form
  196. // form_set_error('uniquename', t("example update cannot proceed. The example name '$node->uniquename' is not unique for this organism. Please provide a unique name for this example."));
  197. }
  198. // Validating for an insert
  199. else {
  200. // if there is a problem with a field then you can set an error on the form
  201. // form_set_error('uniquename', t("example insert cannot proceed. The example name '$node->uniquename' already exists for this organism. Please provide a unique name for this example."));
  202. }
  203. }
  204. /**
  205. * Implementation of hook_insert(). This function is called after the
  206. * node is inserted into the database. We need it so that we can insert
  207. * appropriate fields as provided by the user into the database. And so that
  208. * we can link the new Drupal node to the data in Chado via the chado_example
  209. * linking table. We can get to this function also during "syncing".
  210. * With syncing, however, the data already exists in Chado and we do not want
  211. * to try to re-add it. But we do need to add an entry to the chado_example table
  212. * to link the Drupal node with the data in the 'example' table of Chado.
  213. *
  214. * This function is not required if the hook_node_info() does not define
  215. * any custom node types.
  216. *
  217. * @ingroup tripal_example
  218. */
  219. function chado_example_insert($node) {
  220. // be sure to always trim text fields
  221. //$node->uniquename = trim($node->uniquename);
  222. // if there is an example_id in the $node object then this must be a sync so
  223. // we can skip adding the example as it is already there, although
  224. // we do need to proceed with the rest of the insert
  225. if (!property_exists($node, 'example_id')) {
  226. // ADD TO CHADO
  227. // * Example Table *
  228. // perform the insert using the tripal_core_chado_insert function();
  229. //$values = array(
  230. // 'uniquename' => $node->uniquename,
  231. // 'residues' => $residues,
  232. //);
  233. //$example = chado_select_record('example', array('*'), $values);
  234. //if (!$example) {
  235. // drupal_set_message(t('Unable to add example.'), 'warning');
  236. // tripal_report_error('tripal_example', TRIPAL_WARNING, 'Insert example: Unable to create example where values: %values',
  237. // array('%values' => print_r($values, TRUE)));
  238. // return;
  239. //}
  240. // get the example_id for linking Drupal node with Chado data
  241. // $example_id = $example->example_id;
  242. // Only add to other chado tables if the base record was inserted properly
  243. if ($example_id > 0) {
  244. // * Properties Form *
  245. // If you implemented the properties form in chado_example_form then you need to
  246. // handle inserting these properties into your chado prop table.
  247. // $details = array(
  248. // 'property_table' => 'exampleprop', // the name of the prop table
  249. // 'base_table' => 'example', // the name of your chado base table
  250. // 'foreignkey_name' => 'example_id', // the name of the key in your base table
  251. // 'foreignkey_value' => $example_id // the value of the example_id key
  252. // );
  253. // chado_update_node_form_properties($node, $details);
  254. // * Additional DBxrefs Form *
  255. // If you implemented the dbxrefs form in chado_example_form then you need to
  256. // handle inserting these database references into your chado _dbxref table.
  257. // $details = array(
  258. // 'linking_table' => 'example_dbxref', // the name of your _dbxref table
  259. // 'foreignkey_name' => 'example_id', // the name of the key in your base table
  260. // 'foreignkey_value' => $example_id // the value of the example_id key
  261. // );
  262. // chado_update_node_form_dbxrefs($node, $details);
  263. // * Relationships Form *
  264. // If you implemented the relationships form in chado_example_form then you need to
  265. // handle inserting these relationships into your chado _relationship table.
  266. // $details = array(
  267. // 'relationship_table' => 'example_relationship', // name of the _relationship table
  268. // 'foreignkey_value' => $example_id // value of the example_id key
  269. // );
  270. // chado_update_node_form_relationships($node, $details);
  271. }
  272. }
  273. else {
  274. // the node has an example_id so get it for linking Drupal node with Chado data
  275. // $example_id = $node->example_id;
  276. }
  277. // Make sure the entry for this example doesn't already exist in the
  278. // chado_example table if it doesn't exist then we want to add it.
  279. // $check_org_id = chado_get_id_from_nid('example', $node->nid);
  280. //if (!$check_org_id) {
  281. // $record = new stdClass();
  282. // $record->nid = $node->nid;
  283. // $record->vid = $node->vid;
  284. // $record->example_id = $example_id;
  285. // drupal_write_record('chado_example', $record);
  286. //}
  287. }
  288. /**
  289. * Implementation of hook_update(). This function runs after the
  290. * node has been inserted into the Drupal schema and allows us to
  291. * update the record in Chado.
  292. *
  293. * This function is not required if the hook_node_info() does not define
  294. * any custom node types.
  295. *
  296. * @ingroup tripal_example
  297. */
  298. function chado_example_update($node) {
  299. // be sure to always trim text fields
  300. // $node->uniquename = trim($node->uniquename);
  301. // use the chado_update_record() function to update the record
  302. //$match = array(
  303. //'example_id' => $example_id,
  304. //);
  305. //$values = array(
  306. // 'uniquename' => $node->uniquename,
  307. //);
  308. //$options = array('return_record' => TRUE);
  309. //$status = chado_update_record('example', $match, $values, $options);
  310. //if (!$status) {
  311. // drupal_set_message(t('Unable to update example.'), 'warning');
  312. // tripal_report_error('tripal_example', TRIPAL_WARNING, 'Update example: Unable to update example where values: %values',
  313. // array('%values' => print_r($values, TRUE)));
  314. //}
  315. // * Properties Form *
  316. // If you implemented the properties form in chado_example_form then you need to
  317. // handle updating these properties into your chado prop table.
  318. // $details = array(
  319. // 'property_table' => 'exampleprop', // the name of the prop table
  320. // 'base_table' => 'example', // the name of your chado base table
  321. // 'foreignkey_name' => 'example_id', // the name of the key in your base table
  322. // 'foreignkey_value' => $example_id // the value of the example_id key
  323. // );
  324. // chado_update_node_form_properties($node, $details);
  325. // * Additional DBxrefs Form *
  326. // If you implemented the dbxrefs form in chado_example_form then you need to
  327. // handle updating these database references into your chado _dbxref table.
  328. // $details = array(
  329. // 'linking_table' => 'example_dbxref', // the name of your _dbxref table
  330. // 'foreignkey_name' => 'example_id', // the name of the key in your base table
  331. // 'foreignkey_value' => $example_id // the value of the example_id key
  332. // );
  333. // chado_update_node_form_dbxrefs($node, $details);
  334. // * Relationships Form *
  335. // If you implemented the relationships form in chado_example_form then you need to
  336. // handle updating these relationships into your chado _relationship table.
  337. // $details = array(
  338. // 'relationship_table' => 'example_relationship', // name of the _relationship table
  339. // 'foreignkey_value' => $example_id // value of the example_id key
  340. // );
  341. // chado_update_node_form_relationships($node, $details);
  342. }
  343. /**
  344. * Implementation of hook_delete(). This function runs after the
  345. * node has been deleted from the Drupal schema and allows us to
  346. * delete the corresponding recrod in Chado.
  347. *
  348. * This function is not required if the hook_node_info() does not define
  349. * any custom node types.
  350. *
  351. * @ingroup tripal_example
  352. */
  353. function chado_example_delete($node) {
  354. // get the example id from the node
  355. //$example_id = chado_get_id_from_nid('example', $node->nid);
  356. // if we don't have a example id for this node then this isn't a node of
  357. // type chado_example or the entry in the chado_example table was lost.
  358. if (!$example_id) {
  359. return;
  360. }
  361. // remove the entry in the chado_exapmle table linking the deleted
  362. // Drupal node with the data in chado
  363. // $sql_del = "DELETE FROM {chado_example} WHERE nid = :nid AND vid = :vid";
  364. // db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  365. // Remove data from example tables of chado database. This will
  366. // cause a cascade delete and remove all data in referencing tables
  367. // for this example
  368. // chado_query("DELETE FROM {example} WHERE example_id = :example_id", array(':example_id' => $example_id));
  369. // inform the user that the data was deleted
  370. drupal_set_message(t("The example and all associated data were removed from Chado"));
  371. }
  372. /**
  373. * Implementation of hook_load(). This function is necessary to load
  374. * into the $node object the fields of the table form Chado. For example
  375. * for the feature table, the chado_feature_load() function adds in
  376. * a feature object which contains all of the fields and sub objects
  377. * for data in tables with foreign key relationships.
  378. *
  379. * This function is not required if the hook_node_info() does not define
  380. * any custom node types.
  381. *
  382. * @ingroup tripal_example
  383. */
  384. function chado_example_load($nodes) {
  385. // there may be multiple nodes that get passed in so we have to iterate through
  386. // them all
  387. foreach ($nodes as $nid => $node) {
  388. // find the example and add in the details
  389. //$example_id = chado_get_id_from_nid('example', $nid);
  390. // build the example variable by using the chado_generate_var() function
  391. //$values = array('example_id' => $example_id);
  392. //$example = chado_generate_var('example', $values);
  393. // for fields in the table that are of type 'text' you may want to include those
  394. // by default, the tripal_core_generate_chado_var does not include text fields as
  395. // they may be very large and including a large text field can slow the page load.
  396. // If you know a text field will never be large and it is important for the
  397. // other functions that will see the node to have access to a field you can
  398. // include it here using the chado_expand_var() function. In most
  399. // cases it is probably best to let the end-user decide if text fields should
  400. // be included by using this function in the templates.
  401. //$example = chado_expand_var($example, 'field', 'example.residues');
  402. // add the new example object to this node.
  403. //$nodes[$nid]->example = $example;
  404. }
  405. }
  406. /**
  407. * Implementation of hook_node_presave(). This node is useful for
  408. * making changes to the node prior to it being saved to the database.
  409. * One useful case for this is to set the title of a node. In some cases
  410. * such as for the organism module, the title will be set depending on
  411. * what genus and species is provided. This hook can allow the title to
  412. * be set using user supplied data before the node is saved. In practice
  413. * any change can be made to any fields in the node object.
  414. *
  415. * This function is not required. You probably won't need it if you
  416. * don't define a custom node type in the hook_node_info() function. But
  417. * it is node type agnostic, so you can use this function to change the
  418. * contents of any node regardless of it's type.
  419. *
  420. * @ingroup tripal_example
  421. */
  422. function tripal_example_node_presave($node) {
  423. // set the title to ensure it is always unique
  424. //switch ($node->type) {
  425. // case 'chado_example':
  426. // $node->title = $node->uniquename;
  427. // break;
  428. //}
  429. }
  430. /**
  431. * Implementation of hook node_insert(). This function is used
  432. * after any a node is inserted into the database. It is different
  433. * from the hook_insert() function above in that it is called after
  434. * any node is saved, regardlesss of it's type. This function is useful
  435. * for making changes to the database after a node is inserted when you
  436. * can't edit the hook_insert() function of a node not defined by this
  437. * module, or to access values of a node when have not yet been saved.
  438. * An example comes from the tripal_feature module where the URL alias
  439. * of a node cannot be set in the hook_insert() function. Therefore
  440. * the tripal_feature module uses this function to set the url path
  441. * of a newly inserted feature node.
  442. *
  443. * This function is not required. You probably won't need it if you
  444. * don't define a custom node type in the hook_node_info() function. But
  445. * it is node type agnostic, so you can use this function to do any
  446. * activity after insert of a node.
  447. *
  448. * @ingroup tripal_example
  449. */
  450. function tripal_example_node_insert($node) {
  451. // set the URL path after inserting. We do it here because we do not know the
  452. // example_id in the presave and cannot do it in the hook_insert()
  453. //switch ($node->type) {
  454. // case 'chado_example':
  455. // if (!$node->example_id) {
  456. // $sql = "SELECT * FROM {chado_example} WHERE nid = :nid";
  457. // $chado_example = db_query($sql, array(':nid' => $node->nid))->fetchObject();
  458. // $node->example_id = $chado_example->example_id;
  459. // }
  460. // // remove any previous alias
  461. // db_query("DELETE FROM {url_alias} WHERE source = :source", array(':source' => "node/$node->nid"));
  462. // // set the URL for this example page
  463. // $url_alias = tripal_example_get_example_url($node);
  464. // $path_alias = array("source" => "node/$node->nid", "alias" => $url_alias);
  465. // path_save($path_alias);
  466. // break;
  467. //}
  468. }
  469. /**
  470. * Implementation of hook node_update(). This function is used
  471. * after any a node is updated in the database. It is different
  472. * from the hook_update() function above in that it is called after
  473. * any node is updated, regardlesss of it's type. This function is useful
  474. * for making changes to the database after a node is updated when you
  475. * can't perform changes in the hook_upate() function of a node not defined by this
  476. * module, or to access values of a node when have not yet been updated.
  477. * An example comes from the tripal_feature module where the URL alias
  478. * of a node cannot be set in the hook_update() function. Therefore
  479. * the tripal_feature module uses this function to reset the url path
  480. * of an updated feature node.
  481. *
  482. * This function is not required. You probably won't need it if you
  483. * don't define a custom node type in the hook_node_info() function. But
  484. * it is node type agnostic, so you can use this function to do any
  485. * activity after insert of a node.
  486. *
  487. */
  488. function tripal_example_node_update($node) {
  489. // add items to other nodes, build index and search results
  490. switch ($node->type) {
  491. case 'chado_example':
  492. // remove any previous alias
  493. //db_query("DELETE FROM {url_alias} WHERE source = :source", array(':source' => "node/$node->nid"));
  494. // set the URL for this example page
  495. //$url_alias = tripal_example_get_example_url($node);
  496. //$path_alias = array("source" => "node/$node->nid", "alias" => $url_alias);
  497. //path_save($path_alias);
  498. break;
  499. }
  500. }
  501. /**
  502. * Implementation of hook_node_view(). This function allows you to
  503. * add custom content to any node page. It is node type agnostic.
  504. * Here we typically use it to add content to our custom node type or
  505. * to other Tripal node types. Typically for Tripal, a content "block"
  506. * (e.g. feature properties, feature dbxref, feature pub) has a corresponding
  507. * template file. Those template files are first defined to Drupal using
  508. * the hook_theme() function defined in the tripal_example.module file. Here
  509. * we can add items to a node's content by calling those templates as needed.
  510. *
  511. * @ingroup tripal_example
  512. */
  513. function tripal_example_node_view($node, $view_mode, $langcode) {
  514. switch ($node->type) {
  515. case 'chado_example':
  516. // there are different ways a node can be viewed. Primarily Tripal
  517. // supports full page view and teaser view.
  518. if ($view_mode == 'full') {
  519. // there is always a base template. This is the template that
  520. // is first shown when the example node type is first displayed
  521. //$node->content['tripal_example_base'] = array(
  522. // '#markup' => theme('tripal_example_base', array('node' => $node)),
  523. // '#tripal_toc_id' => 'base',
  524. // '#tripal_toc_title' => 'Overview',
  525. // '#weight' => -100,
  526. //);
  527. // we can add other templates as well.
  528. //$node->content['tripal_example_properties'] = array(
  529. // '#markup' => theme('tripal_example_properties', array('node' => $node)),
  530. // '#tripal_toc_id' => 'properties',
  531. // '#tripal_toc_title' => 'Properties',
  532. //);
  533. //$node->content['tripal_example_publications'] = array(
  534. // '#markup' => theme('tripal_example_publications', array('node' => $node)),
  535. // '#tripal_toc_id' => 'publications',
  536. // '#tripal_toc_title' => 'Publications',
  537. //);
  538. //$node->content['tripal_example_references'] = array(
  539. // '#markup' => theme('tripal_example_references', array('node' => $node)),
  540. // '#tripal_toc_id' => 'references',
  541. // '#tripal_toc_title' => 'Cross References',
  542. //);
  543. }
  544. // set the content for the teaser view
  545. if ($view_mode == 'teaser') {
  546. //$node->content['tripal_example_teaser'] = array(
  547. // '#value' => theme('tripal_example_teaser', array('node' => $node)),
  548. //);
  549. }
  550. break;
  551. // you can add custom content to any tripal node type by adding
  552. // content to the node in the same way as above.
  553. case 'chado_organism':
  554. break;
  555. case 'chado_library':
  556. break;
  557. case 'chado_stock':
  558. break;
  559. case 'chado_analysis':
  560. break;
  561. // ... etc
  562. }
  563. }