Chado Node API
Many Tripal modules implement Drupal node types as a means of displaying chado records individually through Drupal as a single web page. In order to do this, many of the same drupal hooks are implemented and the code between modules is actually quite similar. This API aims to abstract much of the common functionality in order to make it easier for new Tripal modules to implement drupal node types and to centralize the maintenance effort as much as possible.
A generic sync form has been created. See chado_node_sync_form() for instructions on how to implement this form in your module.
Many of the base chado tables also have associated prop, _dbxref and _relationship tables. Generic mini-forms have been created to help you handle these forms. To implement this functionality you call the mini-form from your module node form and then call the associated update functions from both your hook_insert and hook_update. The functions of interest are as follows:
- chado_add_node_form_properties() and chado_update_node_form_properties() to provide an interface for adding/removing properties
- chado_add_node_form_dbxrefs() and chado_update_node_form_dbxrefs() to provide an interface for adding/removing additional database references
- chado_add_node_form_relationships() and chado_update_node_form_relationships() to provide an interface for adding/removing relationships between chado records from your base table
Parent topics
File
- tripal_core/
api/ tripal_core.chado_nodes.api.inc, line 7 - API to handle much of the common functionality implemented when creating a drupal node type.
Functions
Name | Location | Description |
---|---|---|
chado_get_node_title |
tripal_core/ |
Get the title of a node based on the Title Format set in the admin section of the module. If the format has not yet been set than the the unique constrain and name fields will be used to generate a default format |
chado_add_admin_form_set_title |
tripal_core/ |
Generic "Set Node Title" sub-form for setting the title of any chado node |
chado_get_node_url |
tripal_core/ |
Get the url of a node based on the url Format set in the admin section of the module. If the format has not yet been set than the the unique constrain and name fields will be used to generate a default format |
chado_add_admin_form_set_url |
tripal_core/ |
Generic "Set Node URL" sub-form for setting the url of any chado node |
chado_add_node_form_relationships |
tripal_core/ |
Provides a form for adding to BASE_relationship and relationship tables |
theme_chado_add_node_form_relationships_table |
tripal_core/ |
Function to theme the add/remove relationships form into a table |
chado_retrieve_node_form_relationships |
tripal_core/ |
This function is used in a hook_insert, hook_update for a node form when the relationships form has been added to the form. It retrieves all of the relationships and returns them in an array of the format: |
chado_update_node_form_relationships |
tripal_core/ |
This function is used in hook_insert or hook_update and handles inserting of relationships between the current nodetype and other memebers of the same nodetype |
theme_chado_add_node_form_properties |
tripal_core/ |
Function to theme the add/remove properties form into a table |
chado_retrieve_node_form_properties |
tripal_core/ |
This function is used in a hook_insert, hook_update for a node form when the chado node properties form has been added to the form. It retrieves all of the properties and returns them in an array of the format: |
chado_update_node_form_properties |
tripal_core/ |
This function is used in hook_insert or hook_update and handles inserting of any new properties |
chado_add_node_form_dbxrefs |
tripal_core/ |
Provides a form for adding to BASE_dbxref and dbxref tables |
theme_chado_add_node_form_dbxrefs_table |
tripal_core/ |
Function to theme the add/remove dbxrefs form into a table |
chado_retrieve_node_form_dbxrefs |
tripal_core/ |
This function is used in a hook_insert, hook_update for a node form when the additional_dbxrefs form has been added to the form. It retrieves all of the dbxrefs and returns them in an array of the format: |
chado_update_node_form_dbxrefs |
tripal_core/ |
This function is used in hook_insert or hook_update and handles inserting of any new dbxrefs and creation of links between those dbxrefs and node content |
chado_get_id_from_nid |
tripal_core/ |
Get chado id for a node. E.g, if you want to get 'analysis_id' from the 'analysis' table for a synced 'chado_analysis' node, (the same for organisms and features): $analysis_id = chado_get_id_from_nid… |
chado_get_nid_from_id |
tripal_core/ |
Get node id for a chado feature/organism/analysis. E.g, if you want to get the node id for an analysis, use: $nid = chado_get_nid_from_id ('analysis', $analysis_id) Likewise, $nid = chado_get_nid_from_id ('organism',… |
chado_node_get_base_table |
tripal_core/ |
Determine the chado base table for a given content type |
chado_node_sync_form |
tripal_core/ |
Generic Sync Form to aid in sync'ing (create drupal nodes linking to chado content) any chado node type. |
chado_node_sync_records |
tripal_core/ |
Generic function for syncing records in Chado with Drupal nodes. |
chado_cleanup_orphaned_nodes |
tripal_core/ |
This function is a wrapper for the chado_cleanup_orphaned_nodes function. It breaks up the work of chado_cleanup_orphaned_nodes into smaller pieces that are more managable for servers that may have low php memory settings. |
chado_cleanup_orphaned_nodes_part |
tripal_core/ |
This function will delete Drupal nodes for any sync'ed table (e.g. feature, organism, analysis, stock, library) if the chado record has been deleted or the entry in the chado_[table] table has been removed. |
hook_chado_node_sync_create_new_node |
tripal_core/ |
Create New Node |
hook_chado_node_sync_form |
tripal_core/ |
Alter the Chado node sync form. |
hook_chado_node_sync_form_submit |
tripal_core/ |
Bypass chado node api sync form submit. |
hook_chado_node_sync_select_query |
tripal_core/ |
Alter the query that retrieves records to be sync'd (optional) |
Files
Name | Location | Description |
---|---|---|
tripal_core.chado_nodes.relationships.api.inc |
tripal_core/ |
API to manage the chado _relationship table for various Tripal Node Types |
tripal_core.chado_nodes.properties.api.inc |
tripal_core/ |
API to manage the chado prop table for various Tripal Node Types |
tripal_core.chado_nodes.dbxrefs.api.inc |
tripal_core/ |
API to manage the chado _dbxref table for various Tripal Node Types |