function tripal_feature_add_ONE_relationship_form
1.x tripal_feature-relationships.inc | tripal_feature_add_ONE_relationship_form($form_state, $node) |
Implements Hook_form() Handles adding of Relationships to Features
Related topics
2 string references to 'tripal_feature_add_ONE_relationship_form'
- tripal_feature_add_ALL_relationships_page in tripal_feature/
includes/ tripal_feature-relationships.inc - tripal_feature_edit_ALL_relationships_page in tripal_feature/
includes/ tripal_feature-relationships.inc
File
- tripal_feature/
includes/ tripal_feature-relationships.inc, line 32 - @todo Add file header description
Code
function tripal_feature_add_ONE_relationship_form($form_state, $node) {
$feature_id = $node->feature_id;
$organism_id = $node->organism->organism_id;
$_SESSION['organism'] = $organism_id; //needed for autocomplete enter feature 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, X part_of Y, where X & Y are genomic features.')
);
$form['add_relationships']['subject_id'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#description' => 'The Uniquename, Name, Database Reference or Synonym of a Feature can be used here',
);
$cv = tripal_cv_get_cv_by_name('relationship');
$type_options = tripal_cv_get_cvterm_options($cv->cv_id);
$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 Feature 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_feature_id'] = array(
'#type' => 'value',
'#value' => $feature_id,
'#required' => TRUE
);
$form['add_relationships']['r_feature_uniquename'] = array(
'#type' => 'value',
'#value' => $node->uniquename,
'#required' => TRUE
);
return $form;
}