public function TripalTerm::__construct

3.x TripalTerm.inc public TripalTerm::__construct($values = array())

File

tripal/includes/TripalTerm.inc, line 6

Class

TripalTerm
A class the controller will use for instantiating the TripalTerm entity.

Code

public function __construct($values = array()) {
  parent::__construct($values, 'TripalTerm');

  // Get the vocabulary for this term
  $vocab = entity_load('TripalVocab', array('id' => $this->vocab_id));
  $vocab = reset($vocab);
  $this->vocab = $vocab;

  // Get the term description from the storage backend
  $this->definition = NULL;
  $this->url = NULL;

  $term_details = tripal_get_term_details($vocab->vocabulary, $this->accession);
  if ($term_details) {
    if ($term_details and $term_details['definition']) {
      $this->definition = $term_details['definition'];
    }
    if ($term_details and $term_details['url']) {
      $this->url = $term_details['url'];
    }
  }
}