function tripal_cv_edit_form
1.x tripal_cv_admin.inc | tripal_cv_edit_form(&$form_state = NULL, $cvid = NULL) |
Purpose: Provides a form to allow updating/deleteing of controlled vocabularies
Related topics
1 string reference to 'tripal_cv_edit_form'
- tripal_ajax_cv_edit in tripal_cv/
includes/ tripal_cv_admin.inc - Purpose: The edit controlled vocabulary javascript
File
- tripal_cv/
includes/ tripal_cv_admin.inc, line 69
Code
function tripal_cv_edit_form(&$form_state = NULL, $cvid = NULL) {
$sql = "SELECT * FROM {cv} WHERE cv_id = %d ";
$cv = db_fetch_object(chado_query($sql, $cvid));
// set the default values. If there is a value set in the
// form_state then let's use that, otherwise, we'll pull
// the values from the database
$default_db = $form_state['values']['name'];
$default_desc = $form_state['values']['description'];
$default_url = $form_state['values']['url'];
$default_urlprefix = $form_state['values']['urlprefix'];
if (!$default_db) {
$default_cv = $cv->name;
}
if (!$default_desc) {
$default_desc = $cv->definition;
}
$form['cvid'] = array(
'#type' => 'hidden',
'#value' => $cvid
);
$form['name'] = array(
'#type' => 'textfield',
'#title' => t("Controlled Vocabulary name"),
'#description' => t('Please enter the name for this vocabulary.'),
'#required' => FALSE,
'#default_value' => $default_cv,
'#weight' => 1
);
$form['definition'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#description' => t('Please enter a description for this vocabulary'),
'#default_value' => $default_desc,
'#weight' => 2
);
$form['update'] = array(
'#type' => 'submit',
'#value' => t('Update'),
'#weight' => 5,
'#executes_submit_callback' => TRUE,
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#weight' => 6,
'#executes_submit_callback' => TRUE,
);
$form['#redirect'] = 'admin/tripal/tripal_cv';
return $form;
}