1 | <?php |
||
10 | class ReadonlyField extends FormField { |
||
11 | |||
12 | protected $readonly = true; |
||
13 | |||
14 | /** |
||
15 | * Include a hidden field in the HTML for the readonly field |
||
16 | * @var boolean |
||
17 | */ |
||
18 | protected $includeHiddenField = false; |
||
19 | |||
20 | protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_TEXT; |
||
21 | |||
22 | /** |
||
23 | * If true, a hidden field will be included in the HTML for the readonly field. |
||
24 | * |
||
25 | * This can be useful if you need to pass the data through on the form submission, as |
||
26 | * long as it's okay than an attacker could change the data before it's submitted. |
||
27 | * |
||
28 | * This is disabled by default as it can introduce security holes if the data is not |
||
29 | * allowed to be modified by the user. |
||
30 | * |
||
31 | * @param boolean $includeHiddenField |
||
32 | * @return $this |
||
33 | */ |
||
34 | public function setIncludeHiddenField($includeHiddenField) { |
||
38 | |||
39 | /** |
||
40 | * @return bool |
||
41 | */ |
||
42 | public function getIncludeHiddenField() { |
||
45 | |||
46 | public function performReadonlyTransformation() { |
||
49 | |||
50 | public function Type() { |
||
53 | |||
54 | public function castingHelper($field) { |
||
63 | |||
64 | |||
65 | /** |
||
66 | * If $dontEscape is true the returned value will be plain text |
||
67 | * and should be escaped in templates via .XML |
||
68 | * |
||
69 | * If $dontEscape is false the returned value will be safely encoded, |
||
70 | * but should not be escaped by the frontend. |
||
71 | * |
||
72 | * @return mixed|string |
||
73 | */ |
||
74 | public function Value() { |
||
85 | |||
86 | /** |
||
87 | * Get custom cating helper for Value() field |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getValueCast() { |
||
101 | |||
102 | } |
||
103 |