Checkbox.php
1.12 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
<?php
namespace ACA\BP\Field\Profile;
use ACA\BP\Editing;
use ACA\BP\Export;
use ACA\BP\Field\Profile;
use ACA\BP\Filtering;
use ACA\BP\Search;
use ACP;
class Checkbox extends Profile {
public function get_value( $id ) {
return ac_helper()->html->small_block( $this->column->get_raw_value( $id ) );
}
public function editing() {
return new ACP\Editing\Service\Basic(
new ACP\Editing\View\CheckboxList( $this->get_options() ),
new Editing\Storage\Profile\MultiChoices( $this->column->get_buddypress_field_id() )
);
}
public function filtering() {
return new Filtering\Profile\Serialized( $this->column );
}
public function sorting() {
return new ACP\Sorting\Model\Disabled();
}
public function export() {
return new Export\MultipleValues( $this->column );
}
public function search() {
return new Search\Profile\MultipleChoice( $this->column->get_buddypress_field_id(), $this->get_options() );
}
private function get_options() {
$options = [];
foreach ( $this->column->get_buddypress_field()->get_children() as $option ) {
$options[ $option->name ] = $option->name;
}
return $options;
}
}