1 | <?php |
||
27 | class Domains extends Field |
||
28 | { |
||
29 | /** |
||
30 | * @var bool |
||
31 | */ |
||
32 | public $unique = true; |
||
33 | |||
34 | /** |
||
35 | * @var int|null The maximum number of relations this field can have (used if [[allowLimit]] is set to true) |
||
36 | */ |
||
37 | public $limit; |
||
38 | |||
39 | /** |
||
40 | * @var bool Whether to allow the Limit setting |
||
41 | */ |
||
42 | public $allowLimit = true; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | public $defaultStatus = 'pending'; |
||
48 | |||
49 | /** |
||
50 | * @inheritdoc |
||
51 | */ |
||
52 | public static function displayName(): string |
||
56 | |||
57 | /** |
||
58 | * @return array |
||
59 | */ |
||
60 | public function getStatuses(): array |
||
68 | |||
69 | /** |
||
70 | * @inheritdoc |
||
71 | */ |
||
72 | public static function hasContentColumn(): bool |
||
76 | |||
77 | |||
78 | /******************************************* |
||
79 | * ELEMENT |
||
80 | *******************************************/ |
||
81 | |||
82 | /** |
||
83 | * @inheritdoc |
||
84 | */ |
||
85 | public function modifyElementsQuery(ElementQueryInterface $query, $value) |
||
111 | |||
112 | /** |
||
113 | * @inheritdoc |
||
114 | */ |
||
115 | public function getElementValidationRules(): array |
||
126 | |||
127 | |||
128 | /******************************************* |
||
129 | * NORMALIZE VALUE |
||
130 | *******************************************/ |
||
131 | |||
132 | /** |
||
133 | * @inheritdoc |
||
134 | */ |
||
135 | public function normalizeValue($value, ElementInterface $element = null) |
||
154 | |||
155 | /** |
||
156 | * @param DomainsQuery $query |
||
157 | * @param $value |
||
158 | * @param ElementInterface|null $element |
||
159 | */ |
||
160 | private function normalizeQueryValue(DomainsQuery $query, $value, ElementInterface $element = null) |
||
174 | |||
175 | /** |
||
176 | * @param DomainsQuery $query |
||
177 | * @param array $value |
||
178 | * @param ElementInterface|null $element |
||
179 | */ |
||
180 | private function normalizeQueryInputValue(DomainsQuery $query, array $value, ElementInterface $element = null) |
||
204 | |||
205 | /** |
||
206 | * @param DomainsQuery $query |
||
207 | */ |
||
208 | private function normalizeQueryEmptyValue(DomainsQuery $query) |
||
212 | |||
213 | /** |
||
214 | * @param DomainsQuery $query |
||
215 | * @param string $value |
||
216 | * @param ElementInterface|null $element |
||
217 | */ |
||
218 | private function normalizeQuery(DomainsQuery $query, string $value = null, ElementInterface $element = null) |
||
227 | |||
228 | |||
229 | /** |
||
230 | * @param DomainsQuery $value |
||
231 | * @inheritdoc |
||
232 | */ |
||
233 | public function getSearchKeywords($value, ElementInterface $element): string |
||
243 | |||
244 | |||
245 | /******************************************* |
||
246 | * VIEWS |
||
247 | *******************************************/ |
||
248 | |||
249 | /** |
||
250 | * @param DomainsQuery $value |
||
251 | * @inheritdoc |
||
252 | */ |
||
253 | public function getInputHtml($value, ElementInterface $element = null): string |
||
257 | |||
258 | |||
259 | /******************************************* |
||
260 | * EVENTS |
||
261 | *******************************************/ |
||
262 | |||
263 | /** |
||
264 | * @inheritdoc |
||
265 | */ |
||
266 | public function afterSave(bool $isNew) |
||
271 | |||
272 | /** |
||
273 | * @inheritdoc |
||
274 | */ |
||
275 | public function afterDelete() |
||
280 | |||
281 | /** |
||
282 | * @inheritdoc |
||
283 | */ |
||
284 | public function afterElementSave(ElementInterface $element, bool $isNew) |
||
294 | |||
295 | |||
296 | /******************************************* |
||
297 | * UTILITIES |
||
298 | *******************************************/ |
||
299 | |||
300 | /** |
||
301 | * Returns the site ID that target elements should have. |
||
302 | * |
||
303 | * @param ElementInterface|Element|null $element |
||
304 | * |
||
305 | * @return int |
||
306 | */ |
||
307 | protected function targetSiteId(ElementInterface $element = null): int |
||
316 | } |
||
317 |