1 | <?php |
||
32 | abstract class IntegrationField extends SortableFields |
||
33 | { |
||
34 | /** |
||
35 | * @inheritdoc |
||
36 | */ |
||
37 | const TARGET_ATTRIBUTE = IntegrationAssociation::TARGET_ATTRIBUTE; |
||
38 | |||
39 | /** |
||
40 | * @inheritdoc |
||
41 | */ |
||
42 | const SOURCE_ATTRIBUTE = IntegrationAssociation::SOURCE_ATTRIBUTE; |
||
43 | |||
44 | /** |
||
45 | * @return IntegrationAssociations |
||
46 | */ |
||
47 | abstract protected function associationService(): IntegrationAssociations; |
||
48 | |||
49 | /** |
||
50 | * @var Integrations[] |
||
51 | */ |
||
52 | private $fields = []; |
||
53 | |||
54 | /** |
||
55 | * @var IntegrationActionInterface[] |
||
56 | */ |
||
57 | protected $defaultAvailableActions = []; |
||
58 | |||
59 | /** |
||
60 | * @var IntegrationItemActionInterface[] |
||
61 | */ |
||
62 | protected $defaultAvailableItemActions = []; |
||
63 | |||
64 | /** |
||
65 | * @param int $id |
||
66 | * @return Integrations|null |
||
67 | */ |
||
68 | public function findById(int $id) |
||
81 | |||
82 | |||
83 | /** |
||
84 | * @inheritdoc |
||
85 | * @param Integrations $field |
||
86 | * @return IntegrationAssociationQuery |
||
87 | * @throws Exception |
||
88 | */ |
||
89 | public function getQuery( |
||
103 | |||
104 | /** |
||
105 | * @param FieldInterface $field |
||
106 | * @param ElementInterface|null $element |
||
107 | * @return IntegrationAssociationQuery |
||
108 | * @throws Exception |
||
109 | */ |
||
110 | private function baseQuery( |
||
131 | |||
132 | |||
133 | /******************************************* |
||
134 | * NORMALIZE VALUE |
||
135 | *******************************************/ |
||
136 | |||
137 | /** |
||
138 | * @inheritdoc |
||
139 | * @throws \Throwable |
||
140 | */ |
||
141 | protected function normalizeQueryInputValue( |
||
169 | |||
170 | /** |
||
171 | * @param Integrations $field |
||
172 | * @param IntegrationAssociationQuery $query |
||
173 | * @param ElementInterface|null $element |
||
174 | * @param bool $static |
||
175 | * @return null|string |
||
176 | * @throws Exception |
||
177 | * @throws \Twig_Error_Loader |
||
178 | */ |
||
179 | public function getInputHtml( |
||
192 | |||
193 | /** |
||
194 | * @param Integrations $field |
||
195 | * @param IntegrationAssociationQuery $query |
||
196 | * @param ElementInterface|null $element |
||
197 | * @param bool $static |
||
198 | * @return array |
||
199 | * @throws \craft\errors\MissingComponentException |
||
200 | * @throws \yii\base\InvalidConfigException |
||
201 | */ |
||
202 | protected function inputHtmlVariables( |
||
243 | |||
244 | /** |
||
245 | * @param Integrations $field |
||
246 | * @return string |
||
247 | * @throws Exception |
||
248 | * @throws \Twig_Error_Loader |
||
249 | * @throws \craft\errors\MissingComponentException |
||
250 | * @throws \yii\base\InvalidConfigException |
||
251 | */ |
||
252 | public function getSettingsHtml( |
||
260 | |||
261 | /** |
||
262 | * @param Integrations $field |
||
263 | * @return array |
||
264 | * @throws \craft\errors\MissingComponentException |
||
265 | * @throws \yii\base\InvalidConfigException |
||
266 | */ |
||
267 | protected function settingsHtmlVariables(Integrations $field): array |
||
276 | |||
277 | |||
278 | /******************************************* |
||
279 | * OBJECT |
||
280 | *******************************************/ |
||
281 | |||
282 | /** |
||
283 | * @param Integrations $field |
||
284 | * @return string |
||
285 | */ |
||
286 | public function getObjectLabel(Integrations $field): string |
||
290 | |||
291 | /******************************************* |
||
292 | * ACTIONS |
||
293 | *******************************************/ |
||
294 | |||
295 | /** |
||
296 | * @param Integrations $field |
||
297 | * @return IntegrationActionInterface[] |
||
298 | * @throws \craft\errors\MissingComponentException |
||
299 | * @throws \yii\base\InvalidConfigException |
||
300 | */ |
||
301 | public function getAvailableActions(Integrations $field): array |
||
317 | |||
318 | /** |
||
319 | * @param Integrations $field |
||
320 | * @param ElementInterface|null $element |
||
321 | * @return IntegrationActionInterface[] |
||
322 | * @throws \craft\errors\MissingComponentException |
||
323 | * @throws \yii\base\InvalidConfigException |
||
324 | */ |
||
325 | public function getActions(Integrations $field, ElementInterface $element = null): array |
||
342 | |||
343 | /** |
||
344 | * @param Integrations $field |
||
345 | * @return IntegrationActionInterface[] |
||
346 | * @throws \craft\errors\MissingComponentException |
||
347 | * @throws \yii\base\InvalidConfigException |
||
348 | */ |
||
349 | public function getAvailableItemActions(Integrations $field): array |
||
365 | |||
366 | /** |
||
367 | * @param Integrations $field |
||
368 | * @param ElementInterface|null $element |
||
369 | * @return IntegrationItemActionInterface[] |
||
370 | * @throws \craft\errors\MissingComponentException |
||
371 | * @throws \yii\base\InvalidConfigException |
||
372 | */ |
||
373 | public function getItemActions(Integrations $field, ElementInterface $element = null): array |
||
390 | |||
391 | /** |
||
392 | * @param array $actions |
||
393 | * @param string $instance |
||
394 | * @return array |
||
395 | * @throws \craft\errors\MissingComponentException |
||
396 | * @throws \yii\base\InvalidConfigException |
||
397 | */ |
||
398 | protected function resolveActions(array $actions, string $instance) |
||
413 | |||
414 | /** |
||
415 | * @param Integrations $field |
||
416 | * @param ElementInterface|null $element |
||
417 | * @return array |
||
418 | * @throws \craft\errors\MissingComponentException |
||
419 | * @throws \yii\base\InvalidConfigException |
||
420 | */ |
||
421 | protected function getActionHtml(Integrations $field, ElementInterface $element = null): array |
||
437 | |||
438 | /** |
||
439 | * @param Integrations $field |
||
440 | * @param ElementInterface|null $element |
||
441 | * @return array |
||
442 | * @throws \craft\errors\MissingComponentException |
||
443 | * @throws \yii\base\InvalidConfigException |
||
444 | */ |
||
445 | protected function getItemActionHtml(Integrations $field, ElementInterface $element = null): array |
||
461 | } |
||
462 |