NetworkSite.php
905 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
42
43
44
45
46
47
<?php
namespace AC\ListTable;
use AC\ListTable;
use WP_MS_Sites_List_Table;
class NetworkSite implements ListTable
{
use WpListTableTrait;
public function __construct(WP_MS_Sites_List_Table $table)
{
$this->table = $table;
}
public function get_column_value(string $column, int $id): string
{
ob_start();
$method = 'column_' . $column;
$blog = get_site($id);
if ( ! $blog) {
return '';
}
if (method_exists($this->table, $method)) {
call_user_func([$this->table, $method], $blog->to_array());
} else {
$this->table->column_default($blog->to_array(), $column);
}
return ob_get_clean();
}
public function render_row(int $id): string
{
ob_start();
$this->table->single_row(get_site($id));
return ob_get_clean();
}
}