function tripal_cv_get_cvterm_options

2.x tripal_cv.DEPRECATED.inc tripal_cv_get_cvterm_options($cv_id = 0)
3.x tripal_cv.DEPRECATED.inc tripal_cv_get_cvterm_options($cv_id = 0)
1.x tripal_cv.api.inc tripal_cv_get_cvterm_options($cv_id = 0)

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 returned

Return value

An array(cvterm_id => name) for each cvterm in the chado cvterm table where cv_id=that supplied

Related topics

7 calls to tripal_cv_get_cvterm_options()
chado_stock_form in tripal_stock/tripal_stock.module
Implements hook_form(): Creates the main Add/Edit/Delete Form for chado stocks
tripal_feature_add_ONE_relationship_form in tripal_feature/includes/tripal_feature-relationships.inc
Implements Hook_form() Handles adding of Relationships to Features
tripal_feature_edit_ALL_relationships_form in tripal_feature/includes/tripal_feature-relationships.inc
Implements Hook_form() Handles adding of Properties & Synonyms to Stocks
tripal_stock_add_ONE_property_form in tripal_stock/includes/tripal_stock-properties.inc
tripal_stock_add_ONE_relationship_form in tripal_stock/includes/tripal_stock-relationships.inc
Implements Hook_form(): Handles adding of Relationships to Stocks

... See full list

File

tripal_cv/api/tripal_cv.api.inc, line 338
Controlled Vocabulary API

Code

function tripal_cv_get_cvterm_options($cv_id = 0) {

  if ($cv_id > 0) {
    $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array('cv_id' => $cv_id));
  }
  else {
    $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array());
  }

  $options = array();
  foreach ($results as $r) {
    $options[$r->cvterm_id] = $r->name;
  }

  return $options;

}