function tripal_cv_add_cv_form_fields
2.x tripal_cv.cv_form.inc | tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) |
3.x tripal_chado.cv.inc | tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) |
Form fields in common between the cv add & edit form.
Related topics
2 calls to tripal_cv_add_cv_form_fields()
- tripal_cv_cv_add_form in tripal_cv/
includes/ tripal_cv.cv_form.inc - Form to add contolled vocabularies
- tripal_cv_cv_edit_form in tripal_cv/
includes/ tripal_cv.cv_form.inc - Provides the actual "Select CV" form on the Update/Delete Controlled Vocabulary page. This form also triggers the edit javascript @todo Modify this form to use Drupal AJAX
File
- tripal_cv/
includes/ tripal_cv.cv_form.inc, line 100 - Provides a form for creating & editing chado controlled vocabularies
Code
function tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) {
$default_name = '';
$default_desc = '';
if ($cv_id) {
$values = array('cv_id' => $cv_id);
$result = chado_select_record('cv', array('*'), $values);
$cv = $result[0];
$default_name = $cv->name;
$default_desc = $cv->definition;
}
// add a fieldset for the Drupal Schema API
$form['fields'] = array(
'#type' => 'fieldset',
'#title' => 'Controlled Vocabulary Details',
'#collapsible' => 0,
);
$form['fields']['name'] = array(
'#type' => 'textfield',
'#title' => t("Controlled Vocabulary name"),
'#description' => t('Please enter the name for this vocabulary.'),
'#required' => TRUE,
'#default_value' => $default_name,
'#maxlength' => 255,
);
$form['fields']['definition'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#description' => t('Please enter a definition for this vocabulary'),
'#default_value' => $default_desc,
);
return $form;
}