Taxonomy.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Relation; |
| 4 | |
| 5 | use AC\Relation; |
| 6 | |
| 7 | class Taxonomy extends Relation { |
| 8 | |
| 9 | /** |
| 10 | * @var object |
| 11 | */ |
| 12 | private $taxonomy; |
| 13 | |
| 14 | public function __construct( $id ) { |
| 15 | parent::__construct( $id ); |
| 16 | |
| 17 | $this->taxonomy = get_taxonomy( $this->get_id() ); |
| 18 | } |
| 19 | |
| 20 | public function get_type() { |
| 21 | return 'taxonomy'; |
| 22 | } |
| 23 | |
| 24 | public function get_taxonomy() { |
| 25 | return $this->taxonomy; |
| 26 | } |
| 27 | |
| 28 | public function get_labels() { |
| 29 | if ( ! $this->taxonomy ) { |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | return $this->taxonomy->labels; |
| 34 | } |
| 35 | |
| 36 | } |