1 | <?php |
||
28 | abstract class Integrations extends Field |
||
29 | { |
||
30 | /** |
||
31 | * The Plugin's translation category |
||
32 | */ |
||
33 | const TRANSLATION_CATEGORY = ''; |
||
34 | |||
35 | /** |
||
36 | * The action path to preform field actions |
||
37 | */ |
||
38 | const ACTION_PREFORM_ACTION_PATH = ''; |
||
39 | |||
40 | /** |
||
41 | * The action path to preform field actions |
||
42 | */ |
||
43 | const ACTION_PREFORM_ITEM_ACTION_PATH = ''; |
||
44 | |||
45 | /** |
||
46 | * The action path to associate an item |
||
47 | */ |
||
48 | const ACTION_ASSOCIATION_ITEM_PATH = ''; |
||
49 | |||
50 | /** |
||
51 | * The action path to dissociate an item |
||
52 | */ |
||
53 | const ACTION_DISSOCIATION_ITEM_PATH = ''; |
||
54 | |||
55 | /** |
||
56 | * The action path to create an integration object |
||
57 | */ |
||
58 | const ACTION_CREATE_ITEM_PATH = ''; |
||
59 | |||
60 | /** |
||
61 | * The action event name |
||
62 | */ |
||
63 | const EVENT_REGISTER_ACTIONS = 'registerActions'; |
||
64 | |||
65 | /** |
||
66 | * The action event name |
||
67 | */ |
||
68 | const EVENT_REGISTER_AVAILABLE_ACTIONS = 'registerAvailableActions'; |
||
69 | |||
70 | /** |
||
71 | * The item action event name |
||
72 | */ |
||
73 | const EVENT_REGISTER_ITEM_ACTIONS = 'registerItemActions'; |
||
74 | |||
75 | /** |
||
76 | * The item action event name |
||
77 | */ |
||
78 | const EVENT_REGISTER_AVAILABLE_ITEM_ACTIONS = 'registerAvailableItemActions'; |
||
79 | |||
80 | /** |
||
81 | * The input template path |
||
82 | */ |
||
83 | const INPUT_TEMPLATE_PATH = ''; |
||
84 | |||
85 | /** |
||
86 | * The input template path |
||
87 | */ |
||
88 | const INPUT_ITEM_TEMPLATE_PATH = '_inputItem'; |
||
89 | |||
90 | /** |
||
91 | * The input template path |
||
92 | */ |
||
93 | const SETTINGS_TEMPLATE_PATH = ''; |
||
94 | |||
95 | /** |
||
96 | * @var string |
||
97 | */ |
||
98 | public $object; |
||
99 | |||
100 | /** |
||
101 | * @var int|null |
||
102 | */ |
||
103 | public $min; |
||
104 | |||
105 | /** |
||
106 | * @var int|null |
||
107 | */ |
||
108 | public $max; |
||
109 | |||
110 | /** |
||
111 | * @var string |
||
112 | */ |
||
113 | public $viewUrl = ''; |
||
114 | |||
115 | /** |
||
116 | * @var string |
||
117 | */ |
||
118 | public $listUrl = ''; |
||
119 | |||
120 | /** |
||
121 | * @var IntegrationActionInterface[] |
||
122 | */ |
||
123 | public $selectedActions = []; |
||
124 | |||
125 | /** |
||
126 | * @var IntegrationItemActionInterface[] |
||
127 | */ |
||
128 | public $selectedItemActions = []; |
||
129 | |||
130 | /** |
||
131 | * @var string|null |
||
132 | */ |
||
133 | public $selectionLabel; |
||
134 | |||
135 | /** |
||
136 | * @return IntegrationField |
||
137 | */ |
||
138 | abstract protected function fieldService(): IntegrationField; |
||
139 | |||
140 | /** |
||
141 | * @return IntegrationAssociations |
||
142 | */ |
||
143 | abstract protected function associationService(): IntegrationAssociations; |
||
144 | |||
145 | /** |
||
146 | * @inheritdoc |
||
147 | */ |
||
148 | public static function hasContentColumn(): bool |
||
152 | |||
153 | /** |
||
154 | * @return string |
||
155 | */ |
||
156 | public static function defaultSelectionLabel(): string |
||
160 | |||
161 | /******************************************* |
||
162 | * OBJECT |
||
163 | *******************************************/ |
||
164 | |||
165 | /** |
||
166 | * @return string |
||
167 | */ |
||
168 | public function getObjectLabel(): string |
||
172 | |||
173 | /******************************************* |
||
174 | * VALIDATION |
||
175 | *******************************************/ |
||
176 | |||
177 | /** |
||
178 | * @inheritdoc |
||
179 | */ |
||
180 | public function getElementValidationRules(): array |
||
199 | |||
200 | |||
201 | |||
202 | /******************************************* |
||
203 | * VALUE |
||
204 | *******************************************/ |
||
205 | |||
206 | /** |
||
207 | * @inheritdoc |
||
208 | */ |
||
209 | public function normalizeValue($value, ElementInterface $element = null) |
||
217 | |||
218 | |||
219 | /******************************************* |
||
220 | * QUERY |
||
221 | *******************************************/ |
||
222 | |||
223 | /** |
||
224 | * @inheritdoc |
||
225 | */ |
||
226 | public function modifyElementsQuery(ElementQueryInterface $query, $value) |
||
234 | |||
235 | |||
236 | /******************************************* |
||
237 | * RULES |
||
238 | *******************************************/ |
||
239 | |||
240 | /** |
||
241 | * @inheritdoc |
||
242 | */ |
||
243 | public function rules() |
||
270 | |||
271 | |||
272 | /******************************************* |
||
273 | * SEARCH |
||
274 | *******************************************/ |
||
275 | |||
276 | /** |
||
277 | * @param IntegrationAssociationQuery $value |
||
278 | * @inheritdoc |
||
279 | */ |
||
280 | public function getSearchKeywords($value, ElementInterface $element): string |
||
291 | |||
292 | |||
293 | /******************************************* |
||
294 | * VIEWS |
||
295 | *******************************************/ |
||
296 | |||
297 | /** |
||
298 | * @inheritdoc |
||
299 | * @param IntegrationAssociationQuery $value |
||
300 | * @throws \Twig_Error_Loader |
||
301 | * @throws \yii\base\Exception |
||
302 | */ |
||
303 | public function getInputHtml($value, ElementInterface $element = null): string |
||
308 | |||
309 | /** |
||
310 | * @inheritdoc |
||
311 | * @throws \Twig_Error_Loader |
||
312 | * @throws \yii\base\Exception |
||
313 | */ |
||
314 | public function getSettingsHtml() |
||
318 | |||
319 | |||
320 | /******************************************* |
||
321 | * EVENTS |
||
322 | *******************************************/ |
||
323 | |||
324 | /** |
||
325 | * @inheritdoc |
||
326 | * @throws \Exception |
||
327 | */ |
||
328 | public function afterElementSave(ElementInterface $element, bool $isNew) |
||
336 | |||
337 | |||
338 | /******************************************* |
||
339 | * SETTINGS |
||
340 | *******************************************/ |
||
341 | |||
342 | /** |
||
343 | * @inheritdoc |
||
344 | */ |
||
345 | public function settingsAttributes(): array |
||
361 | } |
||
362 |