tripal_example.chado_node.inc 26 KB

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