|
@@ -391,6 +391,14 @@ function chado_stock_load($node) {
|
|
|
|
|
|
// Get stock content and add to node
|
|
|
$stock = tripal_core_generate_chado_var('stock', array('stock_id'=>$map->stock_id));
|
|
|
+ //
|
|
|
+ // move expandable fields downwards
|
|
|
+ $node->expandable_fields = $stock->expandable_fields;
|
|
|
+ unset($stock->expandable_fields);
|
|
|
+ $node->expandable_tables = $stock->expandable_tables;
|
|
|
+ unset($stock->expandable_tables);
|
|
|
+ $node->expandable_nodes = $stock->expandable_nodes;
|
|
|
+ unset($stock->expandable_nodes);
|
|
|
$node->stock = $stock;
|
|
|
|
|
|
return $node;
|
|
@@ -421,6 +429,15 @@ function chado_stock_load($node) {
|
|
|
function chado_stock_form($node, $form_state) {
|
|
|
$type = node_get_types('type', $node);
|
|
|
|
|
|
+ // Expand all fields needed
|
|
|
+ $fields_needed = array('stock.uniquename', 'stock.name', 'stock.stock_id', 'stock.type_id', 'stock.organism_id', 'stock.description', 'stock.dbxref_id', 'dbxref.accession', 'dbxref.description', 'dbxref.db_id', 'db.db_id');
|
|
|
+ foreach ($fields_needed as $field_name) {
|
|
|
+ // Check to see if it's excluded and expand it if so
|
|
|
+ if (in_array($field_name, $node->expandable_fields)) {
|
|
|
+ $node = tripal_core_expand_chado_vars($node, 'field', $field_name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// This defines the path for the next step in a simulated multipart form
|
|
|
// NOTE: The %node gets replaced with the nid in insert
|
|
|
$form['next_step_path'] = array(
|
|
@@ -494,6 +511,7 @@ function chado_stock_form($node, $form_state) {
|
|
|
'#required' => TRUE
|
|
|
);
|
|
|
|
|
|
+
|
|
|
$form['details']['stock_description'] = array(
|
|
|
'#type' => 'textarea',
|
|
|
'#title' => t('Notes'),
|
|
@@ -951,10 +969,7 @@ function tripal_stock_preprocess(&$variables){
|
|
|
// to add all of our variables.
|
|
|
if($variables['template_files'][0] == 'node-chado_stock'){
|
|
|
// stock properties
|
|
|
- $variables['node']->stock->stockprop = tripal_core_generate_chado_var(
|
|
|
- 'stockprop',
|
|
|
- array('stock_id'=>$variables['node']->stock->stock_id)
|
|
|
- );
|
|
|
+ $variables['node'] = tripal_core_expand_chado_vars($variables['node'], 'table', 'stockprop');
|
|
|
|
|
|
// stock synonyms
|
|
|
$variables['node']->stock->stock_synonyms = tripal_core_generate_chado_var(
|
|
@@ -969,10 +984,7 @@ function tripal_stock_preprocess(&$variables){
|
|
|
);
|
|
|
|
|
|
// Stock database references
|
|
|
- $variables['node']->stock->stock_dbxref = tripal_core_generate_chado_var(
|
|
|
- 'stock_dbxref',
|
|
|
- array('stock_id'=>$variables['node']->stock->stock_id)
|
|
|
- );
|
|
|
+ $variables['node'] = tripal_core_expand_chado_vars($variables['node'], 'table', 'stock_dbxref');
|
|
|
|
|
|
// Stock Object Relationships
|
|
|
$variables['node']->stock->stock_object_relationships = tripal_core_generate_chado_var(
|
|
@@ -995,10 +1007,7 @@ function tripal_stock_preprocess(&$variables){
|
|
|
*/
|
|
|
function tripal_stock_preprocess_tripal_stock_properties(&$variables){
|
|
|
// stock properties
|
|
|
- $variables['node']->stock->stockprop = tripal_core_generate_chado_var(
|
|
|
- 'stockprop',
|
|
|
- array('stock_id'=>$variables['node']->stock->stock_id)
|
|
|
- );
|
|
|
+ $variables['node'] = tripal_core_expand_chado_vars($variables['node'], 'table', 'stockprop');
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1027,10 +1036,7 @@ function tripal_stock_preprocess_tripal_stock_synonyms(&$variables){
|
|
|
*/
|
|
|
function tripal_stock_preprocess_tripal_stock_references(&$variables){
|
|
|
// Stock database references
|
|
|
- $variables['node']->stock->stock_dbxref = tripal_core_generate_chado_var(
|
|
|
- 'stock_dbxref',
|
|
|
- array('stock_id'=>$variables['node']->stock->stock_id)
|
|
|
- );
|
|
|
+ $variables['node'] = tripal_core_expand_chado_vars($variables['node'], 'table', 'stock_dbxref');
|
|
|
}
|
|
|
|
|
|
/**
|