function chado_get_cvterm_select_options
3.x tripal_chado.cv.api.inc | chado_get_cvterm_select_options($cv_id, $rel_type = FALSE) |
Create an options array to be used in a form element which provides a list of all chado cvterms.
Parameters
$cv_id: The chado cv_id; only cvterms with the supplied cv_id will be returnedl.
$rel_type: Set to TRUE if the terms returned should only be relationship types in the vocabulary. This is useful for creating drop-downs of terms used for relationship linker tables.
Return value
An associative array with the cvterm_id's as keys. The first element in the array has a key of '0' and a value of 'Select a Type'.
Related topics
4 calls to chado_get_cvterm_select_options()
- schema__additional_type_widget::form in tripal_chado/
includes/ TripalFields/ schema__additional_type/ schema__additional_type_widget.inc - taxrank__infraspecific_taxon_widget::form in tripal_chado/
includes/ TripalFields/ taxrank__infraspecific_taxon/ taxrank__infraspecific_taxon_widget.inc - tripal_get_cvterm_select_options in tripal_chado/
api/ modules/ tripal_chado.module.DEPRECATED.api.inc - Create an options array to be used in a form element which provides a list of all chado cvterms.
- uo__unit_widget::form in tripal_chado/
includes/ TripalFields/ uo__unit/ uo__unit_widget.inc
File
- tripal_chado/
api/ modules/ tripal_chado.cv.api.inc, line 311 - Provides API functions specificially for managing controlled vocabulary records in Chado.
Code
function chado_get_cvterm_select_options($cv_id, $rel_type = FALSE) {
$columns = array('cvterm_id', 'name');
$values = array('cv_id' => $cv_id);
if ($rel_type) {
$values['is_relationshiptype'] = 1;
}
$s_options = array('order_by' => array('name' => 'ASC'));
$cvterms = chado_select_record('cvterm', $columns, $values, $s_options);
$options = array();
$options[0] = 'Select a Type';
foreach ($cvterms as $cvterm) {
$options[$cvterm->cvterm_id] = $cvterm->name;
}
return $options;
}