Taxonomy.php
809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace AC\ListTable;
use AC\ListTable;
use WP_Term;
use WP_Terms_List_Table;
class Taxonomy implements ListTable
{
use WpListTableTrait;
private $taxonomy;
public function __construct(WP_Terms_List_Table $table, string $taxonomy)
{
$this->table = $table;
$this->taxonomy = $taxonomy;
}
public function get_column_value(string $column, int $id): string
{
return (string)apply_filters("manage_{$this->taxonomy}_custom_column", '', $column, $id);
}
public function render_row(int $id): string
{
$term = get_term_by('id', $id, $this->taxonomy);
if ( ! $term instanceof WP_Term) {
return '';
}
ob_start();
$this->table->single_row($term);
return ob_get_clean();
}
}