← All changes
|
backend/src/ValueObjects/Field/FieldGeneralSettings.php
+64
-14
0.9
→
1.5
View file →
| @@ -6,13 +6,8 @@ | ||
| 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 | 10 | use IvyForms\Common\Exceptions\ValidationException; |
| 16 | 11 | use IvyForms\ValueObjects\Field\ConfirmationGeneralSettings; |
| 17 | 12 | use IvyForms\ValueObjects\Field\TimeFieldGeneralSettings; |
| 18 | 13 | use IvyForms\ValueObjects\Field\DateFieldGeneralSettings; |
| @@ -93,8 +88,12 @@ | ||
| 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 | /** |
| @@ -116,13 +115,17 @@ | ||
| 116 | 115 | * Whether to show text labels alongside rating. |
| 117 | 116 | * @var bool |
| 118 | 117 | */ |
| 119 | 118 | private bool $showRatingText; |
| 120 | - /** | |
| 119 | + /** | |
| 121 | 120 | * @var string HTML content for HTML field type |
| 122 | 121 | */ |
| 123 | 122 | private string $htmlContent; |
| 124 | 123 | /** |
| 124 | + * @var string Agreement text for GDPR field type | |
| 125 | + */ | |
| 126 | + private string $agreementText; | |
| 127 | + /** | |
| 125 | 128 | * @var bool |
| 126 | 129 | */ |
| 127 | 130 | private bool $limitRange; |
| 128 | 131 | |
| @@ -144,9 +147,11 @@ | ||
| 144 | 147 | * @param bool $phoneAutoDetect |
| 145 | 148 | * @param float|null $minValue |
| 146 | 149 | * @param float|null $maxValue |
| 147 | 150 | * @param float $step |
| 151 | + * @param bool $showGrid | |
| 148 | 152 | * @param string $numberFormat |
| 153 | + * @param ConfirmationGeneralSettings $confirmationSettings | |
| 149 | 154 | * @param TimeFieldGeneralSettings $timeSettings |
| 150 | 155 | * @param DateFieldGeneralSettings $dateSettings |
| 151 | 156 | * @param bool $visible |
| 152 | 157 | * @param bool $showRatingText |
| @@ -173,8 +178,9 @@ | ||
| 173 | 178 | bool $phoneAutoDetect, |
| 174 | 179 | ?float $minValue, |
| 175 | 180 | ?float $maxValue, |
| 176 | 181 | float $step, |
| 182 | + bool $showGrid, | |
| 177 | 183 | string $numberFormat, |
| 178 | 184 | ConfirmationGeneralSettings $confirmationSettings, |
| 179 | 185 | TimeFieldGeneralSettings $timeSettings, |
| 180 | 186 | DateFieldGeneralSettings $dateSettings, |
| @@ -180,8 +186,9 @@ | ||
| 180 | 186 | DateFieldGeneralSettings $dateSettings, |
| 181 | 187 | bool $showRatingText, |
| 182 | 188 | bool $visible = true, |
| 183 | 189 | string $htmlContent = '', |
| 190 | + string $agreementText = '', | |
| 184 | 191 | bool $limitRange = false |
| 185 | 192 | ) { |
| 186 | 193 | $this->label = $label; |
| 187 | 194 | $this->required = $required; |
| @@ -198,15 +205,17 @@ | ||
| 198 | 205 | $this->phoneAutoDetect = $phoneAutoDetect; |
| 199 | 206 | $this->minValue = $minValue; |
| 200 | 207 | $this->maxValue = $maxValue; |
| 201 | 208 | $this->step = $step; |
| 209 | + $this->showGrid = $showGrid; | |
| 202 | 210 | $this->numberFormat = $numberFormat; |
| 203 | 211 | $this->visible = $visible; |
| 204 | 212 | $this->confirmationSettings = $confirmationSettings; |
| 205 | 213 | $this->timeSettings = $timeSettings; |
| 206 | 214 | $this->dateSettings = $dateSettings; |
| 215 | + $this->htmlContent = $htmlContent; | |
| 207 | 216 | $this->showRatingText = $showRatingText; |
| 208 | - $this->htmlContent = $htmlContent; | |
| 217 | + $this->agreementText = $agreementText; | |
| 209 | 218 | $this->limitRange = $limitRange; |
| 210 | 219 | } |
| 211 | 220 | |
| 212 | 221 | /** |
| @@ -443,8 +452,28 @@ | ||
| 443 | 452 | $this->step = $step; |
| 444 | 453 | } |
| 445 | 454 | |
| 446 | 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 | + /** | |
| 447 | 476 | * Get the number format. |
| 448 | 477 | * |
| 449 | 478 | * @return string |
| 450 | 479 | */ |
| @@ -463,8 +492,27 @@ | ||
| 463 | 492 | $this->numberFormat = $numberFormat; |
| 464 | 493 | } |
| 465 | 494 | |
| 466 | 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 | + /** | |
| 467 | 515 | * Get showRatingText flag. |
| 468 | 516 | * @return bool |
| 469 | 517 | */ |
| 470 | 518 | public function isShowRatingText(): bool |
| @@ -482,24 +530,24 @@ | ||
| 482 | 530 | $this->showRatingText = (bool)$val; |
| 483 | 531 | } |
| 484 | 532 | |
| 485 | 533 | /** |
| 486 | - * Get the HTML content. | |
| 534 | + * Get the agreement text. | |
| 487 | 535 | * @return string |
| 488 | 536 | */ |
| 489 | - public function getHtmlContent(): string | |
| 537 | + public function getAgreementText(): string | |
| 490 | 538 | { |
| 491 | - return $this->htmlContent; | |
| 539 | + return $this->agreementText; | |
| 492 | 540 | } |
| 493 | 541 | |
| 494 | 542 | /** |
| 495 | - * Set the HTML content. | |
| 543 | + * Set the agreement text. | |
| 496 | 544 | * |
| 497 | - * @param string $htmlContent | |
| 545 | + * @param string $agreementText | |
| 498 | 546 | */ |
| 499 | - public function setHtmlContent(string $htmlContent): void | |
| 547 | + public function setAgreementText(string $agreementText): void | |
| 500 | 548 | { |
| 501 | - $this->htmlContent = $htmlContent; | |
| 549 | + $this->agreementText = $agreementText; | |
| 502 | 550 | } |
| 503 | 551 | |
| 504 | 552 | /** |
| 505 | 553 | * Get limitRange. |
| @@ -541,12 +589,14 @@ | ||
| 541 | 589 | 'phoneAutoDetect' => $this->isPhoneAutoDetect(), |
| 542 | 590 | 'minValue' => $this->getMinValue(), |
| 543 | 591 | 'maxValue' => $this->getMaxValue(), |
| 544 | 592 | 'step' => $this->getStep(), |
| 593 | + 'showGrid' => $this->getShowGrid(), | |
| 545 | 594 | 'numberFormat' => $this->getNumberFormat(), |
| 546 | 595 | 'visible' => $this->isVisible(), |
| 547 | 596 | 'showRatingText' => $this->isShowRatingText(), |
| 548 | 597 | 'htmlContent' => $this->getHtmlContent(), |
| 598 | + 'agreementText' => $this->getAgreementText(), | |
| 549 | 599 | 'limitRange' => $this->isLimitRange(), |
| 550 | 600 | ], |
| 551 | 601 | $this->confirmationSettings->toArray(), |
| 552 | 602 | $this->timeSettings->toArray(), |