1 | <?php |
||
8 | class Component_toggle |
||
9 | extends AbstractComponent |
||
|
|||
10 | implements ValueComponentInterface, |
||
11 | FilterableComponentInterface, |
||
12 | DisableableComponentInterface |
||
13 | { |
||
14 | public $component_type = 'toggle'; |
||
15 | |||
16 | protected function on_created() |
||
24 | |||
25 | public function default_model() |
||
26 | { |
||
27 | return array( |
||
28 | 'name' => '', |
||
29 | 'id' => '', |
||
30 | 'disabled' => false, |
||
31 | 'required' => false, |
||
32 | 'readonly' => false, |
||
33 | 'multi' => false, |
||
34 | 'data' => array(), |
||
35 | 'default' => array(), |
||
36 | 'filter' => array( $this, 'filter' ), |
||
37 | 'show' => null |
||
38 | ); |
||
39 | } |
||
40 | |||
41 | public function required_arguments() |
||
45 | |||
46 | public function get_template_path() |
||
50 | |||
51 | /** |
||
52 | * This filter is needed when the form is submitted without $.amarkalUIForm, |
||
53 | * since the value of the toggle needs to be splitted into an array (when 'multi' is set to true). |
||
54 | * When using $.amarkalUIForm to submit the form, the component's getValue/setValue will |
||
55 | * handle this. |
||
56 | * |
||
57 | * @param [string|array] $v |
||
58 | * @return [string|array] |
||
59 | */ |
||
60 | public function filter($v) |
||
68 | |||
69 | protected function is_selected( $value ) |
||
77 | } |