function tripal_get_cvterm_default_select_options

2.x tripal_cv.api.inc tripal_get_cvterm_default_select_options($table, $field, $field_desc)
3.x tripal_cv.api.inc tripal_get_cvterm_default_select_options($table, $field, $field_desc)

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 also notify the administrative user if a default vocabulary is missing for the field and if the vocabulary is empty.

Parameters

$table: The name of the table that contains the field with a foreign key relationship to the cvterm table

$field: The table field name that has the foreign key relationship to the cvterm table for which the default vocabulary will be set

$field_desc: A human readable descriptive name for the field

Return value

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

5 calls to tripal_get_cvterm_default_select_options()
chado_contact_form in tripal_contact/includes/tripal_contact.chado_node.inc
Implementation of hook_form().
chado_featuremap_form in tripal_featuremap/includes/tripal_featuremap.chado_node.inc
When editing or creating a new node of type 'chado_featuremap' we need a form. This function creates the form that will be used for this.
chado_library_form in tripal_library/includes/tripal_library.chado_node.inc
Implements hook_form().
chado_pub_form in tripal_pub/includes/tripal_pub.chado_node.inc
Implements hook_form().
chado_stock_form in tripal_stock/includes/tripal_stock.chado_node.inc
Implements hook_form(). Creates the main Add/Edit/Delete Form for chado stocks

File

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

Code

function tripal_get_cvterm_default_select_options($table, $field, $field_desc) {

  $default_cv = tripal_get_default_cv($table, $field);
  $options = array();

  if ($default_cv) {
    $options = tripal_get_cvterm_select_options($default_cv->cv_id);

    if (count($options) == 0) {
      tripal_set_message('There are no ' . $field_desc . '. Please ' .
        l('add terms', 
        'admin/tripal/chado/tripal_cv/cv/' . $default_cv->cv_id . '/cvterm/add', 
        array('attributes' => array('target' => '_blank'))) . ' to the ' .
        $default_cv->name . ' vocabulary.', 
      TRIPAL_WARNING);
    }

  }
  else {
    tripal_set_message('There is not a default vocabulary set for ' . $field_desc . '. ' .
      'Please set one using the ' .
      l('vocabulary defaults configuration page', 
      'admin/tripal/chado/tripal_cv/defaults', 
      array('attributes' => array('target' => '_blank'))) . '.', 
    TRIPAL_WARNING);
  }

  return $options;
}