function tripal_get_default_cv_table

3.x tripal_cv.api.inc tripal_get_default_cv_table($cv_id)

Retrieves the Chado table to which a vocbulary is set as default.

Each table in Chado that has a 'type_id' (or foreign key constraint to the cvterm table) will have a default vocabulary assigned. This indicates to Tripal that terms in that vocabulary are used to set the type_id for that table. An example where this is used is the tripal_get_cvterm_select_options() function which generates a list of options for a select box used in a Drupal form. The select box will list the terms from the default vocabulary in the drop down.

This function uses the vocabulary ID to get the Chado table to which it is assigned.

Parameters

$cv_id: The ID of the vocabulary.

Return value

If an assignment is present, an object containing the 'table_name' and 'field_name' is returned.

Related topics

File

legacy/tripal_cv/api/tripal_cv.api.inc, line 79
Provides legacy application programming interface (API) to manage controlled vocabularies in the Chado database.

Code

function tripal_get_default_cv_table($cv_id) {
  $default = db_select('tripal_cv_defaults', 't')
    ->fields('t', array('table_name', 'field_name'))
    ->condition('cv_id', $cv_id)
    ->execute()
    ->fetchObject();
  return $default;
}