PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / ValueObjects / Field / FieldAdvancedSettings.php

FieldAdvancedSettings.php in The Innovative Form Builder – IvyForms 1.0, at backend/src/ValueObjects/Field/FieldAdvancedSettings.php

271 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @copyright © Melograno Venture Studio. All rights reserved.
5 * @licence See LICENCE.md for license details.
6 */
7
8 namespace IvyForms\ValueObjects\Field;
9
10 use IvyForms\Common\Exceptions\ValidationException;
11
12 /**
13 * Class FieldAdvancedSettings
14 *
15 * @package IvyForms\ValueObjects\Field
16 */
17 final class FieldAdvancedSettings
18 {
19 /**
20 * @var string
21 */
22 public string $defaultValue;
23
24 /**
25 * @var bool
26 */
27 public bool $limitMaxLength;
28
29 /**
30 * @var int
31 */
32 public int $maxLength;
33
34 /**
35 * @var string
36 */
37 public string $labelPosition;
38
39 /**
40 * @var bool
41 */
42 public bool $noDuplicates;
43
44 /**
45 * @var string field prefix (e.g., https://)
46 */
47 private string $inputPrefix;
48
49 /**
50 * @var string field suffix (e.g., .com)
51 */
52 private string $inputSuffix;
53
54 /**
55 * @var string Type of rating icon (star, heart, etc.)
56 */
57 private string $ratingIcon;
58
59 /**
60 * FieldAdvancedSettings constructor.
61 *
62 * @param string $defaultValue
63 * @param bool $limitMaxLength
64 * @param int $maxLength
65 * @param string $labelPosition
66 * @param bool $noDuplicates
67 * @param string $inputPrefix
68 * @param string $inputSuffix
69 * @param string $ratingIcon
70 *
71 */
72 public function __construct(
73 string $defaultValue,
74 bool $limitMaxLength,
75 int $maxLength,
76 string $labelPosition,
77 bool $noDuplicates,
78 string $inputPrefix,
79 string $inputSuffix,
80 string $ratingIcon
81 ) {
82 $this->defaultValue = $defaultValue;
83 $this->limitMaxLength = $limitMaxLength;
84 $this->maxLength = $maxLength;
85 $this->labelPosition = $labelPosition;
86 $this->noDuplicates = $noDuplicates;
87 $this->inputPrefix = $inputPrefix;
88 $this->inputSuffix = $inputSuffix;
89 $this->ratingIcon = $ratingIcon;
90 }
91
92 /**
93 * Get the default value.
94 *
95 * @return string
96 */
97 public function getDefaultValue(): string
98 {
99 return $this->defaultValue;
100 }
101
102 /**
103 * Set the default value.
104 *
105 * @param string $defaultValue
106 */
107 public function setDefaultValue(string $defaultValue): void
108 {
109 $this->defaultValue = $defaultValue;
110 }
111
112 /**
113 * Check if maximum length limit is enabled.
114 *
115 * @return bool
116 */
117 public function isLimitMaxLength(): bool
118 {
119 return $this->limitMaxLength;
120 }
121
122 /**
123 * Set the limit maximum length setting.
124 *
125 * @param bool $limitMaxLength
126 */
127 public function setLimitMaxLength(bool $limitMaxLength): void
128 {
129 $this->limitMaxLength = $limitMaxLength;
130 }
131
132 /**
133 * Get the maximum length.
134 *
135 * @return int
136 */
137 public function getMaxLength(): int
138 {
139 return $this->maxLength;
140 }
141
142 /**
143 * Set the maximum length setting.
144 *
145 * @param int $maxLength
146 */
147 public function setMaxLength(int $maxLength): void
148 {
149 $this->maxLength = $maxLength;
150 }
151
152 /**
153 * Get the label position.
154 *
155 * @return string
156 */
157 public function getLabelPosition(): string
158 {
159 return $this->labelPosition;
160 }
161
162 /**
163 * Set the label position setting.
164 *
165 * @param string $labelPosition
166 */
167 public function setLabelPosition(string $labelPosition): void
168 {
169 $this->labelPosition = $labelPosition;
170 }
171
172 /**
173 * Check if duplicates are not allowed.
174 *
175 * @return bool
176 */
177 public function isNoDuplicates(): bool
178 {
179 return $this->noDuplicates;
180 }
181
182 /**
183 * Set the noDuplicates setting.
184 *
185 * @param bool $noDuplicates
186 */
187 public function setNoDuplicates(bool $noDuplicates): void
188 {
189 $this->noDuplicates = $noDuplicates;
190 }
191
192 /**
193 * Get the field prefix.
194 *
195 * @return string
196 */
197 public function getInputPrefix(): string
198 {
199 return $this->inputPrefix;
200 }
201
202 /**
203 * Set the field prefix.
204 *
205 * @param string $prefix
206 */
207 public function setInputPrefix(string $prefix): void
208 {
209 $this->inputPrefix = $prefix;
210 }
211
212 /**
213 * Get the field suffix.
214 *
215 * @return string
216 */
217 public function getInputSuffix(): string
218 {
219 return $this->inputSuffix;
220 }
221
222 /**
223 * Set the field suffix.
224 *
225 * @param string $suffix
226 */
227 public function setInputSuffix(string $suffix): void
228 {
229 $this->inputSuffix = $suffix;
230 }
231
232 /**
233 * Get the rating icon type.
234 *
235 * @return string
236 */
237 public function getRatingIcon(): string
238 {
239 return $this->ratingIcon;
240 }
241
242 /**
243 * Set the rating icon type.
244 *
245 * @param string $ratingIcon
246 */
247 public function setRatingIcon(string $ratingIcon): void
248 {
249 $this->ratingIcon = $ratingIcon;
250 }
251
252 /**
253 * Convert the advanced settings to an array.
254 *
255 * @return array<string, mixed>
256 */
257 public function toArray(): array
258 {
259 return [
260 'defaultValue' => $this->getDefaultValue(),
261 'limitMaxLength' => $this->isLimitMaxLength(),
262 'maxLength' => $this->getMaxLength(),
263 'labelPosition' => $this->getLabelPosition(),
264 'noDuplicates' => $this->isNoDuplicates(),
265 'inputPrefix' => $this->getInputPrefix(),
266 'inputSuffix' => $this->getInputSuffix(),
267 'ratingIcon' => $this->getRatingIcon(),
268 ];
269 }
270 }
271