123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- class TripalTerm extends Entity {
- public function __construct($values = array()) {
- parent::__construct($values, 'TripalTerm');
-
- $vocab = entity_load('TripalVocab', array('id' => $this->vocab_id));
- $vocab = reset($vocab);
- $this->vocab = $vocab;
-
- $this->definition = NULL;
- $this->urlprefix = NULL;
-
-
-
- $stores = module_invoke_all('vocab_storage_info');
- if (is_array($stores) and count($stores) > 0) {
- $keys = array_keys($stores);
- $module = $stores[$keys[0]]['module'];
- $function = $module . '_vocab_get_term';
- if (function_exists($function)) {
- $term_details = $function($vocab->namespace, $this->accession);
- $this->details = $term_details;
- if ($term_details and $term_details['definition']) {
- $this->definition = $term_details['definition'];
- $this->urlprefix = $term_details['urlprefix'];
- }
- }
- }
- }
- protected function defaultLabel() {
- return $this->name;
- }
- protected function defaultUri() {
- $vocab = 'TODO';
- return array('path' => '/vocabulary/' . $vocab . '/term/' . $this->id);
- }
- public function getDefinition() {
- return '';
- }
- }
|