1 | <?php |
||
35 | class ObjectsField extends SortableFields |
||
36 | { |
||
37 | /** |
||
38 | * @inheritdoc |
||
39 | */ |
||
40 | const SOURCE_ATTRIBUTE = ObjectAssociation::SOURCE_ATTRIBUTE; |
||
41 | |||
42 | /** |
||
43 | * @inheritdoc |
||
44 | */ |
||
45 | const TARGET_ATTRIBUTE = ObjectAssociation::TARGET_ATTRIBUTE; |
||
46 | |||
47 | /** |
||
48 | * HubSpot Object Association fields, indexed by their Id. |
||
49 | * |
||
50 | * @var Objects[] |
||
51 | */ |
||
52 | private $fields = []; |
||
53 | |||
54 | /** |
||
55 | * @inheritdoc |
||
56 | */ |
||
57 | protected static function tableAlias(): string |
||
61 | |||
62 | /** |
||
63 | * @param int $id |
||
64 | * @return Objects|null |
||
65 | */ |
||
66 | public function findById(int $id) |
||
79 | |||
80 | /** |
||
81 | * @inheritdoc |
||
82 | * @return ObjectAssociationQuery |
||
83 | * @throws Exception |
||
84 | */ |
||
85 | protected function getQuery( |
||
99 | |||
100 | /** |
||
101 | * @param FieldInterface $field |
||
102 | * @param ElementInterface|null $element |
||
103 | * @return ObjectAssociationQuery |
||
104 | * @throws Exception |
||
105 | */ |
||
106 | private function baseQuery( |
||
121 | |||
122 | /******************************************* |
||
123 | * NORMALIZE VALUE |
||
124 | *******************************************/ |
||
125 | |||
126 | /** |
||
127 | * @inheritdoc |
||
128 | * @throws Exception |
||
129 | */ |
||
130 | protected function normalizeQueryInputValue( |
||
147 | |||
148 | /** |
||
149 | * @param FieldInterface $field |
||
150 | * @throws Exception |
||
151 | */ |
||
152 | private function ensureField(FieldInterface $field) |
||
162 | |||
163 | |||
164 | /** |
||
165 | * @param Objects $field |
||
166 | * @param ObjectAssociationQuery $query |
||
167 | * @param ElementInterface|null $element |
||
168 | * @param bool $static |
||
169 | * @return null|string |
||
170 | * @throws Exception |
||
171 | * @throws \Twig_Error_Loader |
||
172 | */ |
||
173 | public function getInputHtml( |
||
193 | |||
194 | /** |
||
195 | * @param Objects $field |
||
196 | * @return null|string |
||
197 | * @throws Exception |
||
198 | * @throws \Twig_Error_Loader |
||
199 | */ |
||
200 | public function getSettingsHtml( |
||
212 | |||
213 | |||
214 | /******************************************* |
||
215 | * ACTIONS |
||
216 | *******************************************/ |
||
217 | |||
218 | /** |
||
219 | * @param Objects $field |
||
220 | * @return ObjectActionInterface[] |
||
221 | * @throws \craft\errors\MissingComponentException |
||
222 | * @throws \yii\base\InvalidConfigException |
||
223 | */ |
||
224 | public function getAvailableActions(Objects $field): array |
||
236 | |||
237 | /** |
||
238 | * @param Objects $field |
||
239 | * @param ElementInterface|null $element |
||
240 | * @return ObjectActionInterface[] |
||
241 | * @throws \craft\errors\MissingComponentException |
||
242 | * @throws \yii\base\InvalidConfigException |
||
243 | */ |
||
244 | public function getActions(Objects $field, ElementInterface $element = null): array |
||
258 | |||
259 | /** |
||
260 | * @param Objects $field |
||
261 | * @return ObjectActionInterface[] |
||
262 | * @throws \craft\errors\MissingComponentException |
||
263 | * @throws \yii\base\InvalidConfigException |
||
264 | */ |
||
265 | public function getAvailableItemActions(Objects $field): array |
||
281 | |||
282 | /** |
||
283 | * @param Objects $field |
||
284 | * @param ElementInterface|null $element |
||
285 | * @return ObjectItemActionInterface[] |
||
286 | * @throws \craft\errors\MissingComponentException |
||
287 | * @throws \yii\base\InvalidConfigException |
||
288 | */ |
||
289 | public function getItemActions(Objects $field, ElementInterface $element = null): array |
||
303 | |||
304 | /** |
||
305 | * @param array $actions |
||
306 | * @param string $instance |
||
307 | * @return array |
||
308 | * @throws \craft\errors\MissingComponentException |
||
309 | * @throws \yii\base\InvalidConfigException |
||
310 | */ |
||
311 | protected function resolveActions(array $actions, string $instance) |
||
326 | |||
327 | /** |
||
328 | * @param Objects $field |
||
329 | * @param ElementInterface|null $element |
||
330 | * @return array |
||
331 | * @throws \craft\errors\MissingComponentException |
||
332 | * @throws \yii\base\InvalidConfigException |
||
333 | */ |
||
334 | protected function getActionHtml(Objects $field, ElementInterface $element = null): array |
||
351 | |||
352 | /** |
||
353 | * @param Objects $field |
||
354 | * @param ElementInterface|null $element |
||
355 | * @return array |
||
356 | * @throws \craft\errors\MissingComponentException |
||
357 | * @throws \yii\base\InvalidConfigException |
||
358 | */ |
||
359 | protected function getItemActionHtml(Objects $field, ElementInterface $element = null): array |
||
376 | } |
||
377 |