CustomFields.php
900 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
48
49
50
51
<?php
namespace AC\Helper\Select\Entities;
use AC;
use AC\Helper\Select;
use AC\Helper\Select\Value;
class CustomFields extends Select\Entities
implements Select\Paginated {
/**
* @param array $args
* @param Value $value
*/
public function __construct( array $args = [], Value $value = null ) {
if ( null === $value ) {
$value = new Value\NullFormatter();
}
$args = array_merge( [
'meta_type' => 'post',
'post_type' => false,
], $args );
$query = new AC\Meta\Query( $args['meta_type'] );
$query->select( 'meta_key' )
->distinct()
->order_by( 'meta_key' );
if ( $args['post_type'] ) {
$query->where_post_type( $args['post_type'] );
}
parent::__construct( $query->get(), $value );
}
public function get_total_pages() {
return 1;
}
public function get_page() {
return 1;
}
public function is_last_page() {
return true;
}
}