function chado_retrieve_node_form_relationships
2.x tripal_core.chado_nodes.relationships.api.inc | chado_retrieve_node_form_relationships($node) |
3.x tripal_core.chado_nodes.relationships.api.inc | chado_retrieve_node_form_relationships($node) |
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:
$relationships[<type_id>][<rank>] = array( 'subject_id' => <subject_id>, 'object_id' => <object_id>, );
This array can then be used for inserting or updating relationships manually
Parameters
$node:
Return value
A relationship array
Related topics
2 calls to chado_retrieve_node_form_relationships()
- chado_node_relationships_form_retreive in tripal_core/
api/ tripal_core.DEPRECATED.api.inc - chado_update_node_form_relationships in tripal_core/
api/ tripal_core.chado_nodes.relationships.api.inc - 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
1 string reference to 'chado_retrieve_node_form_relationships'
- chado_node_relationships_form_retreive in tripal_core/
api/ tripal_core.DEPRECATED.api.inc
File
- tripal_core/
api/ tripal_core.chado_nodes.relationships.api.inc, line 934 - API to manage the chado _relationship table for various Tripal Node Types
Code
function chado_retrieve_node_form_relationships($node) {
$rels = array();
if (isset($node->relationship_table)) {
foreach ($node->relationship_table as $type_id => $elements) {
if ($type_id != 'new' AND $type_id != 'details') {
foreach ($elements as $rank => $relationships) {
$rels[$type_id][$rank]['subject_id'] = $relationships['subject_id'];
$rels[$type_id][$rank]['object_id'] = $relationships['object_id'];
}
}
}
}
return $rels;
}