1 | <?php |
||
12 | abstract class choice extends base |
||
13 | { |
||
14 | /** |
||
15 | * @inheritdoc |
||
16 | */ |
||
17 | 17 | public function get_default_props() |
|
25 | |||
26 | /** |
||
27 | * @inheritdoc |
||
28 | */ |
||
29 | 13 | public function get_field_value(array $data) |
|
30 | { |
||
31 | 13 | $default = $this->get_default_value($data); |
|
32 | 13 | $value = $this->request->variable($data['field_name'], $default, true); |
|
33 | |||
34 | 13 | if (empty($value) && $this->request->server('REQUEST_METHOD') !== 'POST') |
|
35 | 13 | { |
|
36 | 13 | $value = $default; |
|
37 | 13 | } |
|
38 | |||
39 | 13 | return $value; |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * @inheritdoc |
||
44 | */ |
||
45 | 12 | public function display_field(array $data) |
|
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | 13 | public function show_form_field($name, array &$data) |
|
67 | |||
68 | /** |
||
69 | * @param $name |
||
70 | * @param array $data |
||
71 | * @param array $selected |
||
72 | */ |
||
73 | 13 | protected function set_field_options($name, array &$data, array $selected) |
|
98 | |||
99 | /** |
||
100 | * @param array $data |
||
101 | * @return string |
||
102 | */ |
||
103 | 13 | protected function get_default_value(array $data) |
|
111 | } |
||
112 |