Rating.php
1.06 KB
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
52
53
<?php
namespace ACA\WC\Column\Comment;
use AC;
use ACA\WC\Editing;
use ACA\WC\Filtering;
use ACA\WC\Sorting;
use ACP;
/**
* @since 3.0
*/
class Rating extends AC\Column\Meta
implements ACP\Editing\Editable, ACP\Filtering\Filterable, ACP\Sorting\Sortable, ACP\Search\Searchable {
public function __construct() {
$this->set_group( 'woocommerce' )
->set_type( 'column-wc-comment_rating' )
->set_label( __( 'Rating', 'woocommerce' ) );
}
public function get_meta_key() {
return 'rating';
}
public function get_value( $id ) {
$rating = $this->get_raw_value( $id );
if ( ! $rating ) {
return $this->get_empty_char();
}
return ac_helper()->html->stars( $rating, 5 );
}
public function editing() {
return new Editing\Comment\Rating();
}
public function filtering() {
return new Filtering\Number( $this );
}
public function sorting() {
return new Sorting\Comment\Rating( $this->get_meta_key() );
}
public function search() {
return new ACP\Search\Comparison\Meta\Number( $this->get_meta_key(), $this->get_meta_type() );
}
}