1 | <?php |
||
26 | class Interval extends Field implements PreviewableFieldInterface |
||
27 | { |
||
28 | |||
29 | /** |
||
30 | * The default value |
||
31 | * |
||
32 | * @var int |
||
33 | */ |
||
34 | public $defaultAmount = 0; |
||
35 | |||
36 | /** |
||
37 | * The default period |
||
38 | * |
||
39 | * @var int |
||
40 | */ |
||
41 | public $defaultPeriod = PeriodType::Days; |
||
42 | |||
43 | /** |
||
44 | * @inheritdoc |
||
45 | */ |
||
46 | public static function displayName(): string |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | public function getContentColumnType(): string |
||
58 | |||
59 | /** |
||
60 | * @param DateInterval $value |
||
61 | * |
||
62 | * @inheritdoc |
||
63 | */ |
||
64 | public function getInputHtml($value, ElementInterface $element = null): string |
||
107 | |||
108 | /** |
||
109 | * @inheritdoc |
||
110 | */ |
||
111 | public function getStaticHtml($value, ElementInterface $element): string |
||
115 | |||
116 | /** |
||
117 | * @inheritdoc |
||
118 | */ |
||
119 | public function serializeValue($value, ElementInterface $element = null) |
||
126 | |||
127 | /** |
||
128 | * @inheritdoc |
||
129 | */ |
||
130 | public function getSearchKeywords($value, ElementInterface $element): string |
||
134 | |||
135 | /** |
||
136 | * @inheritdoc |
||
137 | */ |
||
138 | public function normalizeValue($value, ElementInterface $element = null) |
||
162 | |||
163 | /** |
||
164 | * @param mixed $value |
||
165 | * @param ElementInterface $element |
||
166 | * @return string |
||
167 | */ |
||
168 | public function getTableAttributeHtml($value, ElementInterface $element): string |
||
174 | |||
175 | /** |
||
176 | * @inheritdoc |
||
177 | */ |
||
178 | public function isEmpty($value): bool |
||
182 | |||
183 | /** |
||
184 | * @param DateInterval $dateInterval |
||
185 | * @return string |
||
186 | */ |
||
187 | private function toHumanTimeDurationWithDefault(DateInterval $dateInterval): string |
||
195 | |||
196 | /** |
||
197 | * @param int $seconds |
||
198 | * @return \DateInterval |
||
199 | */ |
||
200 | private function toDateIntervalFromSeconds(int $seconds) |
||
217 | |||
218 | /** |
||
219 | * @param array $interval |
||
220 | * @return DateInterval |
||
221 | */ |
||
222 | private function toDateIntervalFromHumanReadable(array $interval = ['amount' => 0, 'period' => '']) |
||
255 | } |
||
256 |