function tripal_stock_add_ONE_relationship_form
1.x tripal_stock-relationships.inc | tripal_stock_add_ONE_relationship_form($form_state, $node) |
Implements Hook_form(): Handles adding of Relationships to Stocks
Related topics
2 string references to 'tripal_stock_add_ONE_relationship_form'
- tripal_stock_add_ALL_relationships_page in tripal_stock/
includes/ tripal_stock-relationships.inc - tripal_stock_edit_ALL_relationships_page in tripal_stock/
includes/ tripal_stock-relationships.inc
File
- tripal_stock/
includes/ tripal_stock-relationships.inc, line 31 - @todo Add file header description
Code
function tripal_stock_add_ONE_relationship_form($form_state, $node) {
$stock_id = $node->stock->stock_id;
$organism_id = $node->stock->organism_id->organism_id;
$_SESSION['organism'] = $organism_id; //needed for autocomplete enter stock to work
$form['rel_nid'] = array(
'#type' => 'hidden',
'#value' => $node->nid
);
$form['add_relationships'] = array(
'#type' => 'fieldset',
'#title' => t('Add Relationships') . '<span class="form-optional" title="This field is optional">(optional)</span>',
);
$form['add_relationships']['description'] = array(
'#type' => 'item',
'#value' => t('Relationships are specified as follows: (Subject) (Type of Relationship) (Object). For example, Fred is_the_paternal_parent_of Matty, where Fred & Matty are both stocks.')
);
$form['add_relationships']['subject_id'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#description' => 'The Uniquename, Name, Database Reference or Synonym of a Stock can be used here',
);
$type_options = tripal_cv_get_cvterm_options(variable_get('chado_stock_relationship_cv', 'null'));
$type_options[0] = 'Select a Type';
ksort($type_options);
$form['add_relationships']['type_id'] = array(
'#type' => 'select',
'#title' => t('Type of Relationship'),
'#options' => $type_options
);
$form['add_relationships']['object_id'] = array(
'#type' => 'textfield',
'#title' => t('Object'),
'#description' => 'The Uniquename, Name, Database Reference or Synonym of a Stock can be used here',
);
$form['add_relationships']['r_description'] = array(
'#type' => 'textarea',
'#title' => t('Notes on the relationship') . '<span class="form-optional" title="This field is optional">+</span>',
'#description' => t('Should not include Genotypes and Phenotypes'),
);
$form['add_relationships']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add a Relationship')
);
$form['add_relationships']['r_stock_id'] = array(
'#type' => 'value',
'#value' => $stock_id,
'#required' => TRUE
);
$form['add_relationships']['r_stock_uniquename'] = array(
'#type' => 'value',
'#value' => $node->stock->uniquename,
'#required' => TRUE
);
return $form;
}