class TripalTerm

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

Hierarchy

Expanded class hierarchy of TripalTerm

21 string references to 'TripalTerm'
hook_tripal_default_title_format in tripal/api/tripal.entities.api.inc
Implement this hook to define default formats for Tripal Content Types.
TripalContentService_v0_1::addDocBundleClasses in tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc
Adds classes for every content type to the documentation for this service.
TripalContentService_v0_1::doContentTypesList in tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc
Creates a resources that contains the list of content types.
TripalContentService_v0_1::doEntity in tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc
Creates a resource for a single entity.
TripalContentService_v0_1::doEntityList in tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc
Creates a collection of resources for a given type.

... See full list

File

tripal/includes/TripalTerm.inc, line 5

View source
class TripalTerm extends Entity {
  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'];
      }
    }
  }

  protected function defaultLabel() {
    return $this->name;
  }

  protected function defaultUri() {
    $vocab = 'TODO';
    return array('path' => '/vocabulary/' . $vocab . '/term/' . $this->id);
  }

  // Getters //
  public function getName() {
    return $this->name;
  }
  public function getAccession() {
    return $this->vocab->vocabulary . ':' . $this->accession;
  }
  public function getDefinition() {
    return $this->definition;
  }
  public function getURL() {
    return $this->url;
  }
  public function getVocab() {
    return $this->vocab;
  }
  public function getID() {
    return $this->id;
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
TripalTerm::defaultLabel protected function
TripalTerm::defaultUri protected function
TripalTerm::getAccession public function
TripalTerm::getDefinition public function
TripalTerm::getID public function
TripalTerm::getName public function
TripalTerm::getURL public function
TripalTerm::getVocab public function
TripalTerm::__construct public function