| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace FL\Assistant\Data\Transformers; |
| 5 |
|
| 6 |
class TermsTransformer { |
| 7 |
|
| 8 |
public function __invoke( \WP_Term $term ) { |
| 9 |
return [ |
| 10 |
'children' => isset( $term->children ) ? $term->children : [], |
| 11 |
'description' => $term->description, |
| 12 |
'editUrl' => get_edit_term_link( $term->term_id, $term->taxonomy ), |
| 13 |
'id' => $term->term_id, |
| 14 |
'isHierarchical' => is_taxonomy_hierarchical( $term->taxonomy ), |
| 15 |
'parent' => $term->parent, |
| 16 |
'slug' => $term->slug, |
| 17 |
'taxonomy' => $term->taxonomy, |
| 18 |
'title' => $term->name, |
| 19 |
'url' => get_term_link( $term ), |
| 20 |
'count' => $term->count, |
| 21 |
]; |
| 22 |
} |
| 23 |
} |
| 24 |
|