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 | * @inheritdoc |
||
61 | * @throws \Twig\Error\LoaderError |
||
62 | * @throws \Twig\Error\RuntimeError |
||
63 | * @throws \Twig\Error\SyntaxError |
||
64 | */ |
||
65 | public function getInputHtml($value, ElementInterface $element = null): string |
||
108 | |||
109 | /** |
||
110 | * @inheritdoc |
||
111 | */ |
||
112 | public function getStaticHtml($value, ElementInterface $element): string |
||
116 | |||
117 | /** |
||
118 | * @inheritdoc |
||
119 | */ |
||
120 | public function serializeValue($value, ElementInterface $element = null) |
||
127 | |||
128 | /** |
||
129 | * @inheritdoc |
||
130 | */ |
||
131 | public function getSearchKeywords($value, ElementInterface $element): string |
||
135 | |||
136 | /** |
||
137 | * @inheritdoc |
||
138 | */ |
||
139 | public function normalizeValue($value, ElementInterface $element = null) |
||
163 | |||
164 | /** |
||
165 | * @param mixed $value |
||
166 | * @param ElementInterface $element |
||
167 | * @return string |
||
168 | */ |
||
169 | public function getTableAttributeHtml($value, ElementInterface $element): string |
||
175 | |||
176 | /** |
||
177 | * @inheritdoc |
||
178 | */ |
||
179 | public function isValueEmpty($value, ElementInterface $element): bool |
||
183 | |||
184 | /** |
||
185 | * @param DateInterval $dateInterval |
||
186 | * @return string |
||
187 | */ |
||
188 | private function toHumanTimeDurationWithDefault(DateInterval $dateInterval): string |
||
196 | |||
197 | /** |
||
198 | * @param int $seconds |
||
199 | * @return \DateInterval |
||
200 | */ |
||
201 | private function toDateIntervalFromSeconds(int $seconds) |
||
218 | |||
219 | /** |
||
220 | * @param array $interval |
||
221 | * @return DateInterval |
||
222 | */ |
||
223 | private function toDateIntervalFromHumanReadable(array $interval = ['amount' => 0, 'period' => '']) |
||
256 | } |
||
257 |