tripal_contact.module 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions needed for this drupal module.
  5. * The drupal tripal_contact module maps directly to the chado X module.
  6. *
  7. * For documentation regarding the Chado X module:
  8. * @see http://gmod.org/wiki/Chado_General_Module
  9. */
  10. require('api/tripal_contact.api.inc');
  11. require('includes/contact_sync.inc');
  12. require('includes/tripal_contact.admin.inc');
  13. require('includes/tripal_contact.form.inc');
  14. /**
  15. * @defgroup tripal_contact Contact Module
  16. * @ingroup tripal_modules
  17. * @{
  18. * Currently this module only provides support for integration with Drupal
  19. * views and some support for querying using the Tripal Core API.
  20. *
  21. * This module needs further development to support full management of
  22. * contact information within Chado, and full definitions for foreign
  23. * key relationships in Chado.
  24. * @}
  25. */
  26. /*************************************************************************
  27. * Implements hook_views_api()
  28. * Purpose: Essentially this hook tells drupal that there is views support for
  29. * for this module which then includes tripal_contact.views.inc where all the
  30. * views integration code is
  31. *
  32. * @ingroup tripal_contact
  33. */
  34. function tripal_contact_views_api() {
  35. return array(
  36. 'api' => 2.0,
  37. );
  38. }
  39. /**
  40. *
  41. * @ingroup tripal_contact
  42. */
  43. function tripal_contact_init() {
  44. drupal_add_js(drupal_get_path('module', 'tripal_contact') . '/theme/js/tripal_contact.js');
  45. drupal_add_css(drupal_get_path('module', 'tripal_contact') . '/theme/css/tripal_contact.css');
  46. }
  47. /**
  48. * Implementation of hook_tripal_contact_node_info().
  49. *
  50. * This node_info, is a simple node that describes the functionallity of the module.
  51. *
  52. */
  53. function tripal_contact_node_info() {
  54. return array(
  55. 'chado_contact' => array(
  56. 'name' => t('Contact'),
  57. 'base' => 'chado_contact',
  58. 'description' => t('A contact from the Chado database'),
  59. 'title_label' => t('Article Title'),
  60. 'body_label' => t('Abstract'),
  61. 'has_title' => TRUE,
  62. 'has_body' => FALSE,
  63. ),
  64. );
  65. }
  66. /**
  67. * Tripal-contact-Menu
  68. *
  69. * Implemets hook_menu(): Adds menu items for the tripal_contact module menu. This section
  70. * gives the outline for the main menu of the Tripal-contact module
  71. *
  72. * @return
  73. * An array of menu items that is visible within the Drupal Menu, returned as soon
  74. * as the program is ran
  75. */
  76. function tripal_contact_menu() {
  77. $items = array();
  78. $items['admin/tripal/chado/tripal_contact']= array(
  79. 'title' => 'Contacts',
  80. 'description' => ('Model persons, institutes, groups, organizations, etc.'),
  81. 'page callback' => 'tripal_contact_admin_contact_view',
  82. 'access arguments' => array('administer tripal contacts'),
  83. 'type' => MENU_NORMAL_ITEM
  84. );
  85. $items['admin/tripal/chado/tripal_contact/configuration'] = array(
  86. 'title' => 'Settings',
  87. 'description' => 'Integration of Chado contacts.',
  88. 'page callback' => 'drupal_get_form',
  89. 'page arguments' => array('tripal_contact_admin'),
  90. 'access arguments' => array('administer tripal contact'),
  91. 'type' => MENU_LOCAL_TASK,
  92. 'weight' => 5
  93. );
  94. $items['admin/tripal/chado/tripal_contact/help']= array(
  95. 'title' => 'Help',
  96. 'description' => ('Help with the contact module.'),
  97. 'page callback' => 'theme',
  98. 'page arguments' => array('tripal_contact_help'),
  99. 'access arguments' => array('administer tripal contacts'),
  100. 'type' => MENU_LOCAL_TASK,
  101. 'weight' => 10
  102. );
  103. $items['admin/tripal/chado/tripal_contact/sync'] = array(
  104. 'title' => ' Sync',
  105. 'description' => 'Sync contacts in Chado with Drupal',
  106. 'page callback' => 'drupal_get_form',
  107. 'page arguments' => array('tripal_contact_sync_form'),
  108. 'access arguments' => array('administer tripal contacts'),
  109. 'type' => MENU_LOCAL_TASK,
  110. 'weight' => 0
  111. );
  112. // AJAX calls for adding/removing properties to a contact
  113. $items['tripal_contact/properties/add'] = array(
  114. 'page callback' => 'tripal_contact_property_add',
  115. 'access arguments' => array('edit chado_contact content'),
  116. 'type ' => MENU_CALLBACK,
  117. );
  118. $items['tripal_contact/properties/description'] = array(
  119. 'page callback' => 'tripal_contact_property_get_description',
  120. 'access arguments' => array('edit chado_contact content'),
  121. 'type ' => MENU_CALLBACK,
  122. );
  123. $items['tripal_contact/properties/minus/%/%'] = array(
  124. 'page callback' => 'tripal_contact_property_delete',
  125. 'page arguments' => array(3, 4),
  126. 'access arguments' => array('edit chado_contact content'),
  127. 'type ' => MENU_CALLBACK,
  128. );
  129. return $items;
  130. }
  131. /**
  132. * Implements hook_theme(): Register themeing functions for this module
  133. *
  134. *
  135. * @return
  136. * An array of themeing functions to register
  137. *
  138. */
  139. function tripal_contact_theme($existing, $type, $theme, $path) {
  140. $core_path = drupal_get_path('module', 'tripal_core');
  141. $items = array(
  142. 'node__chado_contact' => array(
  143. 'template' => 'node--chado-generic',
  144. 'render element' => 'node',
  145. 'base hook' => 'node',
  146. 'path' => "$core_path/theme",
  147. ),
  148. 'tripal_contact_base' => array(
  149. 'variables' => array('node' => NULL),
  150. 'template' => 'tripal_contact_base',
  151. 'path' => "$path/theme/tripal_contact",
  152. ),
  153. 'tripal_contact_properties' => array(
  154. 'variables' => array('node' => NULL),
  155. 'template' => 'tripal_contact_properties',
  156. 'path' => "$path/theme/tripal_contact",
  157. ),
  158. 'tripal_contact_relationships' => array(
  159. 'variables' => array('node' => NULL),
  160. 'template' => 'tripal_contact_relationships',
  161. 'path' => "$path/theme/tripal_contact",
  162. ),
  163. 'tripal_contact_publications' => array(
  164. 'variables' => array('node' => NULL),
  165. 'template' => 'tripal_contact_publications',
  166. 'path' => "$path/theme/tripal_contact",
  167. ),
  168. 'tripal_contact_help' => array(
  169. 'template' => 'tripal_contact_help',
  170. 'variables' => array(NULL),
  171. 'path' => "$path/theme",
  172. ),
  173. 'tripal_contact_teaser' => array(
  174. 'variables' => array('node' => NULL),
  175. 'template' => 'tripal_contact_teaser',
  176. 'path' => "$path/theme/tripal_contact",
  177. ),
  178. );
  179. return $items;
  180. }
  181. /**
  182. * @ingroup tripal_contact
  183. */
  184. function tripal_contact_block_info() {
  185. $blocks['contbase']['info'] = t('Tripal Contact Details');
  186. $blocks['contbase']['cache'] = 'BLOCK_NO_CACHE';
  187. $blocks['contprops']['info'] = t('Tripal Contact Properties');
  188. $blocks['contprops']['cache'] = 'BLOCK_NO_CACHE';
  189. $blocks['contrels']['info'] = t('Tripal Contact Relationships');
  190. $blocks['contrels']['cache'] = 'BLOCK_NO_CACHE';
  191. $blocks['contpubs']['info'] = t('Tripal Cotact Publications');
  192. $blocks['contpubs']['cache'] = 'BLOCK_NO_CACHE';
  193. return $blocks;
  194. }
  195. /**
  196. * @ingroup tripal_contact
  197. */
  198. function tripal_contact_block_view($delta = '') {
  199. if (user_access('access chado_contact content') and arg(0) == 'node' and is_numeric(arg(1))) {
  200. $nid = arg(1);
  201. $node = node_load($nid);
  202. $block = array();
  203. switch ($delta) {
  204. case 'contbase':
  205. $block['subject'] = t('Details');
  206. $block['content'] = theme('tripal_contact_base', $node);
  207. break;
  208. case 'contprops':
  209. $block['subject'] = t('Properties');
  210. $block['content'] = theme('tripal_contact_properties', $node);
  211. break;
  212. case 'contrels':
  213. $block['subject'] = t('Relationships');
  214. $block['content'] = theme('tripal_contact_relationships', $node);
  215. break;
  216. case 'contpubs':
  217. $block['subject'] = t('Publications');
  218. $block['content'] = theme('tripal_contact_publications', $node);
  219. break;
  220. default :
  221. }
  222. return $block;
  223. }
  224. }
  225. /**
  226. * Implement hook_perm().
  227. */
  228. function tripal_contact_permissions() {
  229. return array(
  230. 'access chado_contact content' => array(
  231. 'title' => t('View Contacts'),
  232. 'description' => t('Allow users to view contact pages.'),
  233. ),
  234. 'create chado_contact content' => array(
  235. 'title' => t('Create Contacts'),
  236. 'description' => t('Allow users to create new contact pages.'),
  237. ),
  238. 'delete chado_contact content' => array(
  239. 'title' => t('Delete Contacts'),
  240. 'description' => t('Allow users to delete contact pages.'),
  241. ),
  242. 'edit chado_contact content' => array(
  243. 'title' => t('Edit Contacts'),
  244. 'description' => t('Allow users to edit contact pages.'),
  245. ),
  246. 'adminster tripal contact' => array(
  247. 'title' => t('Administer Contacts'),
  248. 'description' => t('Allow users to administer all contacts.'),
  249. ),
  250. );
  251. }
  252. /**
  253. * Implement hook_access().
  254. *
  255. * This hook allows node modules to limit access to the node types they define.
  256. *
  257. * @param $node
  258. * The node on which the operation is to be performed, or, if it does not yet exist, the
  259. * type of node to be created
  260. *
  261. * @param $op
  262. * The operation to be performed
  263. *
  264. * @param $account
  265. * A user object representing the user for whom the operation is to be performed
  266. *
  267. * @return
  268. * If the permission for the specified operation is not set then return FALSE. If the
  269. * permission is set then return NULL as this allows other modules to disable
  270. * access. The only exception is when the $op == 'create'. We will always
  271. * return TRUE if the permission is set.
  272. *
  273. */
  274. function chado_contact_node_access($node, $op, $account ) {
  275. if ($op == 'create') {
  276. if (!user_access('create chado_contact content', $account)) {
  277. return FALSE;
  278. }
  279. return TRUE;
  280. }
  281. if ($op == 'update') {
  282. if (!user_access('edit chado_contact content', $account)) {
  283. return FALSE;
  284. }
  285. }
  286. if ($op == 'delete') {
  287. if (!user_access('delete chado_contact content', $account)) {
  288. return FALSE;
  289. }
  290. }
  291. if ($op == 'view') {
  292. if (!user_access('access chado_contact content', $account)) {
  293. return FALSE;
  294. }
  295. }
  296. return NULL;
  297. }
  298. /**
  299. * Implementation of tripal_contact_insert().
  300. *
  301. * This function inserts user entered information pertaining to the contact instance into the
  302. * 'contactauthor', 'contactprop', 'chado_contact', 'contact' talble of the database.
  303. *
  304. * @parm $node
  305. * Then node which contains the information stored within the node-ID
  306. *
  307. *
  308. */
  309. function chado_contact_insert($node) {
  310. // remove surrounding white-space on submitted values
  311. $node->title = trim($node->title);
  312. $node->description = trim($node->description);
  313. // if there is a contact_id in the $node object then this must be a sync so
  314. // we can skip adding the contact as it is already there, although
  315. // we do need to proceed with the rest of the insert
  316. if (!property_exists($node, 'contact_id')) {
  317. // insert and then get the newly inserted contact record
  318. $values = array(
  319. 'name' => $node->title,
  320. 'description' => '',
  321. 'type_id' => $node->type_id,
  322. );
  323. $contact = tripal_core_chado_insert('contact', $values);
  324. if (!$contact) {
  325. drupal_set_message(t('Unable to add contact.', 'warning'));
  326. watchdog('tripal_contact', 'Insert contact: Unable to create contact where values: %values',
  327. array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
  328. return;
  329. }
  330. $contact_id = $contact['contact_id'];
  331. // now add in the properties
  332. $properties = tripal_core_properties_form_retreive($node, 'tripal_contact');
  333. foreach ($properties as $property => $elements) {
  334. foreach ($elements as $rank => $value) {
  335. $status = tripal_contact_insert_property($contact_id, $property, $value, FALSE);
  336. if (!$status) {
  337. drupal_set_message("Error cannot add property: $property", "error");
  338. watchdog('t_contact', "Error cannot add property: %prop",
  339. array('%property' => $property), WATCHDOG_ERROR);
  340. }
  341. }
  342. }
  343. // add in the description as a separate property
  344. tripal_contact_insert_property($contact_id, 'contact_description', $node->description, FALSE);
  345. }
  346. else {
  347. $contact_id = $node->contact_id;
  348. }
  349. // Make sure the entry for this contact doesn't already exist in the
  350. // chado_contact table if it doesn't exist then we want to add it.
  351. $check_org_id = chado_get_id_for_node('contact', $node->nid);
  352. if (!$check_org_id) {
  353. $record = new stdClass();
  354. $record->nid = $node->nid;
  355. $record->vid = $node->vid;
  356. $record->contact_id = $contact_id;
  357. drupal_write_record('chado_contact', $record);
  358. }
  359. return TRUE;
  360. }
  361. /*
  362. *
  363. * Implements hook_update
  364. *
  365. * The purpose of the function is to allow the module to take action when an edited node is being
  366. * updated. It updates any name changes to the database tables that werec reated upon registering a contact.
  367. * As well, the database will be changed, so the user changed information will be saved to the database.
  368. *
  369. * @param $node
  370. * The node being updated
  371. *
  372. * @ingroup tripal_contact
  373. */
  374. function chado_contact_update($node) {
  375. // remove surrounding white-space on submitted values
  376. $node->title = trim($node->title);
  377. $node->description = trim($node->description);
  378. $contact_id = chado_get_id_for_node('contact', $node->nid) ;
  379. // update the contact record
  380. $match = array(
  381. 'contact_id' => $contact_id,
  382. );
  383. $values = array(
  384. 'name' => $node->title,
  385. 'description' => '',
  386. 'type_id' => $node->type_id
  387. );
  388. $status = tripal_core_chado_update('contact', $match, $values);
  389. if (!$status) {
  390. drupal_set_message("Error updating contact", "error");
  391. watchdog('t_contact', "Error updating contact", array(), WATCHDOG_ERROR);
  392. return;
  393. }
  394. // now add in the properties by first removing any the contact
  395. // already has and adding the ones we have
  396. tripal_core_chado_delete('contactprop', array('contact_id' => $contact_id));
  397. $properties = tripal_core_properties_form_retreive($node, 'tripal_contact');
  398. foreach ($properties as $property => $elements) {
  399. foreach ($elements as $rank => $value) {
  400. $status = tripal_contact_insert_property($contact_id, $property, $value, FALSE);
  401. if (!$status) {
  402. drupal_set_message("Error cannot add property: '$property'", "error");
  403. watchdog('t_contact', "Error cannot add property: '%prop'",
  404. array('%prop' => $property), WATCHDOG_ERROR);
  405. }
  406. }
  407. }
  408. // add in the description as a separate property
  409. tripal_contact_update_property($contact_id, 'contact_description', $node->description, 1);
  410. }
  411. /**
  412. * Implementation of tripal_contact_load().
  413. *
  414. *
  415. * @param $node
  416. * The node that is to be accessed from the database
  417. *
  418. * @return $node
  419. * The node with the information to be loaded into the database
  420. *
  421. */
  422. function chado_contact_load($nodes) {
  423. foreach ($nodes as $nid => $node) {
  424. // find the contact and add in the details
  425. $contact_id = chado_get_id_for_node('contact', $nid);
  426. // get the contact
  427. $values = array('contact_id' => $contact_id);
  428. $contact = tripal_core_generate_chado_var('contact', $values);
  429. // get the contact description from the contactprop table and replace
  430. // the contact.description field with this one (we don't use the contact.description
  431. // field because it is only 255 characters (too small)).
  432. $values = array(
  433. 'contact_id' => $contact->contact_id,
  434. 'type_id' => array(
  435. 'name' => 'contact_description',
  436. ),
  437. );
  438. $options = array(
  439. 'return_array' => 1,
  440. 'include_fk' => array('type_id' => 1),
  441. );
  442. $description = tripal_core_generate_chado_var('contactprop', $values, $options);
  443. if (count($description) == 1) {
  444. $description = tripal_core_expand_chado_vars($description, 'field', 'contactprop.value');
  445. $contact->description = $description[0]->value;
  446. }
  447. $nodes[$nid]->contact = $contact;
  448. }
  449. }
  450. /**
  451. * Implementation of tripal_contact_delete().
  452. *
  453. * This function takes a node and if the delete button has been chosen by the user, the contact
  454. * and it's details will be removed.Following,given the node-ID, the instance will be deleted from
  455. * the 'chado_contact' table.
  456. *
  457. * @parm $node
  458. * Then node which contains the information stored within the node-ID
  459. *
  460. */
  461. function chado_contact_delete(&$node) {
  462. $contact_id = chado_get_id_for_node('contact', $node->nid);
  463. // if we don't have a contact id for this node then this isn't a node of
  464. // type chado_contact or the entry in the chado_contact table was lost.
  465. if (!$contact_id) {
  466. return;
  467. }
  468. // Remove data from {chado_contact}, {node} and {node_revisions} tables of
  469. // drupal database
  470. $sql_del = "DELETE FROM {chado_contact} WHERE nid = :nid AND vid = :vid";
  471. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  472. $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
  473. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  474. $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
  475. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  476. // Remove data from contact and contactprop tables of chado database as well
  477. chado_query("DELETE FROM {contactprop} WHERE contact_id = :contact_id", array(':contact_id' => $contact_id));
  478. chado_query("DELETE FROM {contact} WHERE contact_id = :contact_id", array(':contact_id' => $contact_id));
  479. }
  480. /**
  481. *
  482. *
  483. * @ingroup tripal_contact
  484. */
  485. function tripal_contact_preprocess_tripal_contact_relationships(&$variables) {
  486. // we want to provide a new variable that contains the matched contacts.
  487. $contact = $variables['node']->contact;
  488. // normally we would use tripal_core_expand_chado_vars to expand our
  489. // organism object and add in the relationships, however whan a large
  490. // number of relationships are present this significantly slows the
  491. // query, therefore we will manually perform the query
  492. $sql = "
  493. SELECT C.name, C.contact_id, CP.nid, CVT.name as rel_type
  494. FROM {contact_relationship} PR
  495. INNER JOIN {contact} C ON PR.object_id = C.contact_id
  496. INNER JOIN {cvterm} CVT ON PR.type_id = CVT.cvterm_id
  497. LEFT JOIN public.chado_contact CP ON C.contact_id = CP.contact_id
  498. WHERE PR.subject_id = :contact_id
  499. ";
  500. $as_subject = chado_query($sql, array(':contact_id' => $contact->contact_id));
  501. $sql = "
  502. SELECT C.name, C.contact_id, CP.nid, CVT.name as rel_type
  503. FROM {contact_relationship} PR
  504. INNER JOIN {contact} C ON PR.subject_id = C.contact_id
  505. INNER JOIN {cvterm} CVT ON PR.type_id = CVT.cvterm_id
  506. LEFT JOIN public.chado_contact CP ON C.contact_id = CP.contact_id
  507. WHERE PR.object_id = :contact_id
  508. ";
  509. $as_object = chado_query($sql, array(':contact_id' => $contact->contact_id));
  510. // combine both object and subject relationshisp into a single array
  511. $relationships = array();
  512. $relationships['object'] = array();
  513. $relationships['subject'] = array();
  514. // iterate through the object relationships
  515. while ($relationship = $as_object->fetchObject()) {
  516. // get the relationship and child types
  517. $rel_type = t(preg_replace('/_/', " ", $relationship->rel_type));
  518. $sub_type = t(preg_replace('/_/', " ", $relationship->sub_type));
  519. if (!array_key_exists($rel_type, $relationships['object'])) {
  520. $relationships['object'][$rel_type] = array();
  521. }
  522. if (!array_key_exists($sub_type, $relationships['object'][$rel_type])) {
  523. $relationships['object'][$rel_type][$sub_type] = array();
  524. }
  525. $relationships['object'][$rel_type][$sub_type][] = $relationship;
  526. }
  527. // now add in the subject relationships
  528. while ($relationship = $as_subject->fetchObject()) {
  529. // get the relationship and child types
  530. $rel_type = t(preg_replace('/_/', " ", $relationship->rel_type));
  531. $obj_type = t(preg_replace('/_/', " ", $relationship->obj_type));
  532. if (!array_key_exists($rel_type, $relationships['subject'])) {
  533. $relationships['subject'][$rel_type] = array();
  534. }
  535. if (!array_key_exists($obj_type, $relationships['subject'][$rel_type])) {
  536. $relationships['subject'][$rel_type][$obj_type] = array();
  537. }
  538. $relationships['subject'][$rel_type][$obj_type][] = $relationship;
  539. }
  540. $contact->all_relationships = $relationships;
  541. }
  542. /**
  543. * Implementation of hook_form_alter()
  544. *
  545. * @param $form
  546. * @param $form_state
  547. * @param $form_id
  548. */
  549. function tripal_contact_form_alter(&$form, &$form_state, $form_id) {
  550. // turn of preview button for insert/updates
  551. if ($form_id == "chado_contact_node_form") {
  552. $form['actions']['preview']['#access'] = FALSE;
  553. }
  554. }
  555. /**
  556. *
  557. * @ingroup tripal_feature
  558. */
  559. function tripal_contact_node_view($node, $view_mode, $langcode) {
  560. switch ($node->type) {
  561. case 'chado_contact':
  562. // Show feature browser and counts
  563. if ($view_mode == 'full') {
  564. $node->content['tripal_contact_base'] = array(
  565. '#value' => theme('tripal_contact_base', array('node' => $node)),
  566. );
  567. $node->content['tripal_contact_properties'] = array(
  568. '#value' => theme('tripal_contact_properties', array('node' => $node)),
  569. );
  570. $node->content['tripal_contact_publications'] = array(
  571. '#value' => theme('tripal_contact_publications', array('node' => $node)),
  572. );
  573. $node->content['tripal_contact_relationships'] = array(
  574. '#value' => theme('tripal_contact_relationships', array('node' => $node)),
  575. );
  576. }
  577. if ($view_mode == 'teaser') {
  578. $node->content['tripal_contact_teaser'] = array(
  579. '#value' => theme('tripal_contact_teaser', array('node' => $node)),
  580. );
  581. }
  582. break;
  583. }
  584. }