PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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/DateFieldGeneralSettings.php +28 -10 0.8.2 → 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 /**
16 11 * Class DateFieldGeneralSettings
17 12 *
18 13 * Encapsulates date-specific settings extracted from FieldGeneralSettings.
@@ -37,15 +32,21 @@
37 32 /**
38 33 * @var string|null
39 34 */
40 35 private ?string $maxDateValue;
36 + /**
37 + * @var bool
38 + */
39 + private bool $limitDateRange;
41 40
42 41 public function __construct(
42 + bool $limitDateRange,
43 43 string $dateFieldType = '',
44 44 string $dateFormat = '',
45 45 ?string $minDateValue = null,
46 46 ?string $maxDateValue = null
47 47 ) {
48 + $this->limitDateRange = $limitDateRange;
48 49 $this->dateFieldType = $dateFieldType;
49 50 $this->dateFormat = $dateFormat;
50 51 $this->minDateValue = $minDateValue;
51 52 $this->maxDateValue = $maxDateValue;
@@ -115,16 +116,33 @@
115 116 $this->maxDateValue = $maxDateValue;
116 117 }
117 118
118 119 /**
119 - * @return array<string, string|null>
120 + * @return bool
120 121 */
122 + public function isLimitDateRange(): bool
123 + {
124 + return $this->limitDateRange;
125 + }
126 +
127 + /**
128 + * @param bool $limitDateRange
129 + */
130 + public function setLimitDateRange(bool $limitDateRange): void
131 + {
132 + $this->limitDateRange = $limitDateRange;
133 + }
134 +
135 + /**
136 + * @return array<string, string|bool|null>
137 + */
121 138 public function toArray(): array
122 139 {
123 140 return [
124 - 'dateFieldType' => $this->getDateFieldType(),
125 - 'dateFormat' => $this->getDateFormat(),
126 - 'minDateValue' => $this->getMinDateValue(),
127 - 'maxDateValue' => $this->getMaxDateValue(),
141 + 'dateFieldType' => $this->getDateFieldType(),
142 + 'dateFormat' => $this->getDateFormat(),
143 + 'minDateValue' => $this->getMinDateValue(),
144 + 'maxDateValue' => $this->getMaxDateValue(),
145 + 'limitDateRange' => $this->isLimitDateRange(),
128 146 ];
129 147 }
130 148 }