Example #1
0
 /**
  * Get all terms in the given taxonomy.
  *
  * @param  string|\Tev\Taxonomy\Model\Taxonomy $taxonomy Taxonomy object or name
  * @return \Tev\Term\Model\Term[]
  */
 public function getByTaxonomy($taxonomy)
 {
     if (!$taxonomy instanceof Taxonomy) {
         $taxonomy = $this->taxonomyFactory->create($taxonomy);
     }
     return $this->convertTermsArray(get_terms($taxonomy->getName(), array('hide_empty' => false)), $taxonomy);
 }
Example #2
0
 /**
  * Get Term Taxonomy.
  *
  * @return \Tev\Taxonomy\Model\Taxonomy
  */
 public function taxonomy()
 {
     if ($this->_taxonomy === null) {
         $this->_taxonomy = $this->taxonomyFactory->create($this->base['taxonomy']);
     }
     return $this->_taxonomy;
 }
Example #3
0
 /**
  * Get all terms for this post in the given taxonomy.
  *
  * @param  mixed|\Tev\Taxonomy\Model\Taxonomy $taxonomy Taxonomy name or object
  * @return \Tev\Term\Model\Term[]                       Array of terms
  */
 public function getTermsFor($taxonomy)
 {
     if (!$taxonomy instanceof Taxonomy) {
         $taxonomy = $this->taxonomyFactory->create($taxonomy);
     }
     return $taxonomy->getTermsForPost($this);
 }