PluginProbe
The Innovative Form Builder – IvyForms / 1.5.1
The Innovative Form Builder – IvyForms v1.5.1
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
← All changes | backend/src/ValueObjects/Field/FieldGeneralSettings.php +156 -8 0.6 → 1.5.1 View file →
@@ -1,20 +1,15 @@
1 1 <?php
2 2
3 3 /**
4 - * @copyright © TMS-Plugins. All rights reserved.
4 + * @copyright © Melograno Venture Studio. All rights reserved.
5 5 * @licence See LICENCE.md for license details.
6 6 */
7 7
8 8 namespace IvyForms\ValueObjects\Field;
9 9
10 -// phpcs:disable PSR1.Files.SideEffects
11 -if (!defined('ABSPATH')) {
12 - exit; // Exit if accessed directly
13 -}
14 -
15 -
16 10 use IvyForms\Common\Exceptions\ValidationException;
11 +use IvyForms\ValueObjects\Field\ConfirmationGeneralSettings;
17 12 use IvyForms\ValueObjects\Field\TimeFieldGeneralSettings;
18 13 use IvyForms\ValueObjects\Field\DateFieldGeneralSettings;
19 14
20 15 /**
@@ -93,12 +88,21 @@
93 88 * @var float Step increment for number fields
94 89 */
95 90 public float $step;
96 91 /**
92 + * @var bool Show grid marks on slider
93 + */
94 + public bool $showGrid;
95 + /**
97 96 * @var string Number format key
98 97 */
99 98 public string $numberFormat;
100 99 /**
100 + * Confirmation settings grouped in a dedicated value object.
101 + * @var ConfirmationGeneralSettings
102 + */
103 + private ConfirmationGeneralSettings $confirmationSettings;
104 + /**
101 105 * Time settings grouped in a dedicated value object.
102 106 * @var TimeFieldGeneralSettings
103 107 */
104 108 private TimeFieldGeneralSettings $timeSettings;
@@ -106,8 +110,25 @@
106 110 * Date settings grouped in a dedicated value object.
107 111 * @var DateFieldGeneralSettings
108 112 */
109 113 private DateFieldGeneralSettings $dateSettings;
114 + /**
115 + * Whether to show text labels alongside rating.
116 + * @var bool
117 + */
118 + private bool $showRatingText;
119 + /**
120 + * @var string HTML content for HTML field type
121 + */
122 + private string $htmlContent;
123 + /**
124 + * @var string Agreement text for GDPR field type
125 + */
126 + private string $agreementText;
127 + /**
128 + * @var bool
129 + */
130 + private bool $limitRange;
110 131
111 132 /**
112 133 * Public constructor
113 134 *
@@ -126,12 +147,17 @@
126 147 * @param bool $phoneAutoDetect
127 148 * @param float|null $minValue
128 149 * @param float|null $maxValue
129 150 * @param float $step
151 + * @param bool $showGrid
130 152 * @param string $numberFormat
153 + * @param ConfirmationGeneralSettings $confirmationSettings
131 154 * @param TimeFieldGeneralSettings $timeSettings
132 155 * @param DateFieldGeneralSettings $dateSettings
133 156 * @param bool $visible
157 + * @param bool $showRatingText
158 + * @param string $htmlContent
159 + * @param bool $limitRange
134 160 */
135 161 /**
136 162 * @SuppressWarnings("ExcessiveParameterList")
137 163 * @SuppressWarnings("BooleanArgumentFlag")
@@ -152,12 +178,18 @@
152 178 bool $phoneAutoDetect,
153 179 ?float $minValue,
154 180 ?float $maxValue,
155 181 float $step,
182 + bool $showGrid,
156 183 string $numberFormat,
184 + ConfirmationGeneralSettings $confirmationSettings,
157 185 TimeFieldGeneralSettings $timeSettings,
158 186 DateFieldGeneralSettings $dateSettings,
159 - bool $visible = true
187 + bool $showRatingText,
188 + bool $visible = true,
189 + string $htmlContent = '',
190 + string $agreementText = '',
191 + bool $limitRange = false
160 192 ) {
161 193 $this->label = $label;
162 194 $this->required = $required;
163 195 $this->placeholder = $placeholder;
@@ -173,12 +205,18 @@
173 205 $this->phoneAutoDetect = $phoneAutoDetect;
174 206 $this->minValue = $minValue;
175 207 $this->maxValue = $maxValue;
176 208 $this->step = $step;
209 + $this->showGrid = $showGrid;
177 210 $this->numberFormat = $numberFormat;
178 211 $this->visible = $visible;
212 + $this->confirmationSettings = $confirmationSettings;
179 213 $this->timeSettings = $timeSettings;
180 214 $this->dateSettings = $dateSettings;
215 + $this->htmlContent = $htmlContent;
216 + $this->showRatingText = $showRatingText;
217 + $this->agreementText = $agreementText;
218 + $this->limitRange = $limitRange;
181 219 }
182 220
183 221 /**
184 222 * Get the label.
@@ -288,8 +326,17 @@
288 326 return $this->visible;
289 327 }
290 328
291 329 /**
330 + * Accessor for confirmation settings value object.
331 + * @return ConfirmationGeneralSettings
332 + */
333 + public function getConfirmationSettings(): ConfirmationGeneralSettings
334 + {
335 + return $this->confirmationSettings;
336 + }
337 +
338 + /**
292 339 * Accessor for time settings value object.
293 340 * @return TimeFieldGeneralSettings
294 341 */
295 342 public function getTimeSettings(): TimeFieldGeneralSettings
@@ -405,8 +452,28 @@
405 452 $this->step = $step;
406 453 }
407 454
408 455 /**
456 + * Get the show grid value.
457 + *
458 + * @return bool
459 + */
460 + public function getShowGrid(): bool
461 + {
462 + return $this->showGrid;
463 + }
464 +
465 + /**
466 + * Set the show grid value.
467 + *
468 + * @param bool $showGrid
469 + */
470 + public function setShowGrid(bool $showGrid): void
471 + {
472 + $this->showGrid = $showGrid;
473 + }
474 +
475 + /**
409 476 * Get the number format.
410 477 *
411 478 * @return string
412 479 */
@@ -425,8 +492,83 @@
425 492 $this->numberFormat = $numberFormat;
426 493 }
427 494
428 495 /**
496 + * Get the HTML content.
497 + * @return string
498 + */
499 + public function getHtmlContent(): string
500 + {
501 + return $this->htmlContent;
502 + }
503 +
504 + /**
505 + * Set the HTML content.
506 + *
507 + * @param string $htmlContent
508 + */
509 + public function setHtmlContent(string $htmlContent): void
510 + {
511 + $this->htmlContent = $htmlContent;
512 + }
513 +
514 + /**
515 + * Get showRatingText flag.
516 + * @return bool
517 + */
518 + public function isShowRatingText(): bool
519 + {
520 + return $this->showRatingText;
521 + }
522 +
523 + /**
524 + * Set showRatingText flag.
525 + *
526 + * @param bool|null $val
527 + */
528 + public function setShowRatingText(?bool $val): void
529 + {
530 + $this->showRatingText = (bool)$val;
531 + }
532 +
533 + /**
534 + * Get the agreement text.
535 + * @return string
536 + */
537 + public function getAgreementText(): string
538 + {
539 + return $this->agreementText;
540 + }
541 +
542 + /**
543 + * Set the agreement text.
544 + *
545 + * @param string $agreementText
546 + */
547 + public function setAgreementText(string $agreementText): void
548 + {
549 + $this->agreementText = $agreementText;
550 + }
551 +
552 + /**
553 + * Get limitRange.
554 + * @return bool
555 + */
556 + public function isLimitRange(): bool
557 + {
558 + return $this->limitRange;
559 + }
560 +
561 + /**
562 + * Set limitRange.
563 + * @param bool $limitRange
564 + */
565 + public function setLimitRange(bool $limitRange): void
566 + {
567 + $this->limitRange = $limitRange;
568 + }
569 +
570 + /**
429 571 * @return array<string, mixed>
430 572 */
431 573 public function toArray(): array
432 574 {
@@ -447,11 +589,17 @@
447 589 'phoneAutoDetect' => $this->isPhoneAutoDetect(),
448 590 'minValue' => $this->getMinValue(),
449 591 'maxValue' => $this->getMaxValue(),
450 592 'step' => $this->getStep(),
593 + 'showGrid' => $this->getShowGrid(),
451 594 'numberFormat' => $this->getNumberFormat(),
452 595 'visible' => $this->isVisible(),
596 + 'showRatingText' => $this->isShowRatingText(),
597 + 'htmlContent' => $this->getHtmlContent(),
598 + 'agreementText' => $this->getAgreementText(),
599 + 'limitRange' => $this->isLimitRange(),
453 600 ],
601 + $this->confirmationSettings->toArray(),
454 602 $this->timeSettings->toArray(),
455 603 $this->dateSettings->toArray()
456 604 );
457 605 }