| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.8 Free | |
| 4 | + * @version 3.1.14 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | 8 | * @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| @@ -18,10 +18,17 @@ | ||
| 18 | 18 | |
| 19 | 19 | class Field |
| 20 | 20 | { |
| 21 | 21 | /** |
| 22 | + * Field type. Set by subclasses. | |
| 23 | + * | |
| 24 | + * @var string | |
| 25 | + */ | |
| 26 | + protected $type = ''; | |
| 27 | + | |
| 28 | + /** | |
| 22 | 29 | * Field options. |
| 23 | - * | |
| 30 | + * | |
| 24 | 31 | * @var array |
| 25 | 32 | */ |
| 26 | 33 | protected $options = []; |
| 27 | 34 | |
| @@ -79,10 +86,10 @@ | ||
| 79 | 86 | /** |
| 80 | 87 | * Validate the field. |
| 81 | 88 | * |
| 82 | 89 | * @param mixed $value |
| 83 | - * | |
| 84 | - * @return void | |
| 90 | + * | |
| 91 | + * @return bool | |
| 85 | 92 | */ |
| 86 | 93 | public function validate(&$value = '') |
| 87 | 94 | { |
| 88 | 95 | if ($this->isRequired() && empty($value)) |
| @@ -119,15 +126,15 @@ | ||
| 119 | 126 | } |
| 120 | 127 | |
| 121 | 128 | if (is_array($value)) |
| 122 | 129 | { |
| 123 | - return implode(', ', $value); | |
| 130 | + return implode(', ', array_map('\FireBox\Core\Helpers\Form\Field::escape', $value)); | |
| 124 | 131 | } |
| 125 | 132 | |
| 126 | 133 | // Check if the value is a JSON string |
| 127 | 134 | if (is_string($value) && ($json = json_decode($value, true)) && is_array($json)) |
| 128 | 135 | { |
| 129 | - return implode(', ', $json); | |
| 136 | + return implode(', ', array_map('\FireBox\Core\Helpers\Form\Field::escape', $json)); | |
| 130 | 137 | } |
| 131 | 138 | |
| 132 | 139 | // Strings and numbers |
| 133 | 140 | return \FireBox\Core\Helpers\Form\Field::escape($value); |
| @@ -204,9 +211,9 @@ | ||
| 204 | 211 | } |
| 205 | 212 | |
| 206 | 213 | public function getData() |
| 207 | 214 | { |
| 208 | - return $this->Form; | |
| 215 | + return $this->data; | |
| 209 | 216 | } |
| 210 | 217 | |
| 211 | 218 | /** |
| 212 | 219 | * Return the field label. |