User.php
829 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
<?php
namespace ACA\MetaBox\Search\Comparison\Table;
use AC;
use ACP;
use ACP\Search\Value;
class User extends TableStorage implements ACP\Search\Comparison\SearchableValues {
/**
* @var array
*/
protected $query_args;
public function __construct( $operators, $table, $column, $query_args = [], $value_type = Value::INT ) {
$this->query_args = $query_args;
parent::__construct( $operators, $table, $column, $value_type );
}
public function get_values( $search, $page ) {
$args = wp_parse_args( $this->query_args, [
'search' => $search,
'paged' => $page,
] );
$entities = new ACP\Helper\Select\Entities\User( $args );
return new AC\Helper\Select\Options\Paginated(
$entities,
new ACP\Helper\Select\Group\UserRole(
new ACP\Helper\Select\Formatter\UserName( $entities )
)
);
}
}