function chado_retrieve_node_form_dbxrefs

2.x tripal_core.chado_nodes.dbxrefs.api.inc chado_retrieve_node_form_dbxrefs($node)

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:

$dbxefs[<db_id>][<version>][<dbxref_id>] = <accession>

This array can then be used for inserting or updating dbxrefs using the API call tripal_hook_insert_dbxref()

Parameters

$node:

Return value

A dbxref array

Related topics

2 calls to chado_retrieve_node_form_dbxrefs()
chado_node_additional_dbxrefs_form_retreive in tripal_core/api/tripal_core.DEPRECATED.api.inc
chado_update_node_form_dbxrefs in tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc
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
1 string reference to 'chado_retrieve_node_form_dbxrefs'

File

tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc, line 635
API to manage the chado _dbxref table for various Tripal Node Types

Code

function chado_retrieve_node_form_dbxrefs($node) {
  $dbxrefs = array();

  if (isset($node->dbxref_table)) {
    foreach ($node->dbxref_table as $db_id => $elements) {
      if ($db_id != 'new') {
        foreach ($elements as $dbxref_id => $dbxref) {
          $version = (!empty($dbxref['version'])) ? $dbxref['version'] : 'NONE';
          $dbxrefs[$db_id][$version][$dbxref_id] = $dbxref['accession'];
        }
      }
    }
  }

  return $dbxrefs;
}