Checkbox.php
841 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\EC\Column\Event\Field;
use ACA\EC\Column\Event;
use ACA\EC\Editing;
use ACA\EC\Filtering;
use ACA\EC\Search;
use ACP\Editing\Service\Basic;
use ACP\Editing\View;
/**
* @since 1.1.2
*/
class Checkbox extends Event\Field {
public function editing() {
return new Basic(
( new View\CheckboxList( $this->get_field_options() ) )->set_clear_button( true ),
new Editing\Storage\Field\Checkbox( $this->get_meta_key() )
);
}
public function filtering() {
return new Filtering\Event\Field\Checkbox( $this );
}
public function search() {
return new Search\Event\Field\Options( $this->get_meta_key(), $this->get_meta_type(), $this->get_field_options() );
}
private function get_field_options() {
$options = explode( "\r\n", $this->get( 'values' ) );
return array_combine( $options, $options );
}
}