tripal_example.chado_node.inc 26 KB

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