function tripal_get_cvterm_select_options

2.x tripal_cv.api.inc tripal_get_cvterm_select_options($cv_id)
3.x tripal_chado.module.DEPRECATED.api.inc tripal_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 returned

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

5 calls to tripal_get_cvterm_select_options()
chado_library_form in tripal_library/includes/tripal_library.chado_node.inc
Implements hook_form().
chado_organism_form in tripal_organism/includes/tripal_organism.chado_node.inc
Implement hook_form().
chado_project_form in tripal_project/includes/tripal_project.chado_node.inc
Implementation of hook_form().
tripal_cv_get_cvterm_options in tripal_cv/api/tripal_cv.DEPRECATED.inc
tripal_get_cvterm_default_select_options in tripal_cv/api/tripal_cv.api.inc
Create an options array to be used in a form element which provides a list of all chado cvterms. Unlike the tripal_get_cvterm_select_option, this function retreives the cvterms using the default vocabulary set for a given table and field. It will…
1 string reference to 'tripal_get_cvterm_select_options'

File

tripal_cv/api/tripal_cv.api.inc, line 274
This module provides a set of functions to simplify working with controlled vocabularies.

Code

function tripal_get_cvterm_select_options($cv_id) {
  $columns = array('cvterm_id', 'name');
  $values = array('cv_id' => $cv_id);
  $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;

}