1 | <?php |
||
28 | class Objects extends Field |
||
29 | { |
||
30 | /** |
||
31 | * The action event name |
||
32 | */ |
||
33 | const EVENT_REGISTER_ACTIONS = 'registerActions'; |
||
34 | |||
35 | /** |
||
36 | * The action event name |
||
37 | */ |
||
38 | const EVENT_REGISTER_AVAILABLE_ACTIONS = 'registerAvailableActions'; |
||
39 | |||
40 | /** |
||
41 | * The item action event name |
||
42 | */ |
||
43 | const EVENT_REGISTER_ITEM_ACTIONS = 'registerItemActions'; |
||
44 | |||
45 | /** |
||
46 | * The item action event name |
||
47 | */ |
||
48 | const EVENT_REGISTER_AVAILABLE_ITEM_ACTIONS = 'registerAvailableItemActions'; |
||
49 | |||
50 | /** |
||
51 | * The input template path |
||
52 | */ |
||
53 | const INPUT_TEMPLATE_PATH = 'hubspot/_components/fieldtypes/Objects/input'; |
||
54 | |||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | public $object; |
||
59 | |||
60 | /** |
||
61 | * @var int|null |
||
62 | */ |
||
63 | public $min; |
||
64 | |||
65 | /** |
||
66 | * @var int|null |
||
67 | */ |
||
68 | public $max; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | public $viewUrl = ''; |
||
74 | |||
75 | /** |
||
76 | * @var string |
||
77 | */ |
||
78 | public $listUrl = ''; |
||
79 | |||
80 | /** |
||
81 | * @var array |
||
82 | */ |
||
83 | public $selectedActions = []; |
||
84 | |||
85 | /** |
||
86 | * @var array |
||
87 | */ |
||
88 | public $selectedItemActions = []; |
||
89 | |||
90 | /** |
||
91 | * @var string|null |
||
92 | */ |
||
93 | public $selectionLabel; |
||
94 | |||
95 | /** |
||
96 | * Indicates whether the full sync operation should be preformed if a matching HubSpot Object was found but not |
||
97 | * currently associated to the element. For example, when attempting to Sync a Craft User to a HubSpot Contact, if |
||
98 | * the HubSpot Contact already exists; true would override data in HubSpot while false would just perform |
||
99 | * an association (note, a subsequent sync operation could be preformed) |
||
100 | * @var bool |
||
101 | */ |
||
102 | public $syncToHubSpotOnMatch = false; |
||
103 | |||
104 | /** |
||
105 | * @inheritdoc |
||
106 | */ |
||
107 | public static function displayName(): string |
||
111 | |||
112 | /** |
||
113 | * @inheritdoc |
||
114 | */ |
||
115 | public static function defaultSelectionLabel(): string |
||
119 | |||
120 | /** |
||
121 | * @inheritdoc |
||
122 | */ |
||
123 | public static function hasContentColumn(): bool |
||
127 | |||
128 | /******************************************* |
||
129 | * VALIDATION |
||
130 | *******************************************/ |
||
131 | |||
132 | /** |
||
133 | * @inheritdoc |
||
134 | */ |
||
135 | public function getElementValidationRules(): array |
||
154 | |||
155 | /******************************************* |
||
156 | * CONNECTION |
||
157 | *******************************************/ |
||
158 | |||
159 | /** |
||
160 | * @return ConnectionInterface |
||
161 | * @throws \yii\base\InvalidConfigException |
||
162 | */ |
||
163 | public function getConnection(): ConnectionInterface |
||
168 | |||
169 | /******************************************* |
||
170 | * CACHE |
||
171 | *******************************************/ |
||
172 | |||
173 | /** |
||
174 | * @return CacheInterface |
||
175 | * @throws \yii\base\InvalidConfigException |
||
176 | */ |
||
177 | public function getCache(): CacheInterface |
||
182 | |||
183 | /******************************************* |
||
184 | * CRUD |
||
185 | *******************************************/ |
||
186 | |||
187 | /** |
||
188 | * @return CRUDInterface |
||
189 | * @throws InvalidConfigException |
||
190 | */ |
||
191 | public function getResource(): CRUDInterface |
||
205 | |||
206 | /******************************************* |
||
207 | * VALUE |
||
208 | *******************************************/ |
||
209 | |||
210 | /** |
||
211 | * @inheritdoc |
||
212 | */ |
||
213 | public function normalizeValue($value, ElementInterface $element = null) |
||
221 | |||
222 | |||
223 | /******************************************* |
||
224 | * ELEMENT |
||
225 | *******************************************/ |
||
226 | |||
227 | /** |
||
228 | * @inheritdoc |
||
229 | */ |
||
230 | public function modifyElementsQuery(ElementQueryInterface $query, $value) |
||
238 | |||
239 | |||
240 | /******************************************* |
||
241 | * RULES |
||
242 | *******************************************/ |
||
243 | |||
244 | /** |
||
245 | * @inheritdoc |
||
246 | */ |
||
247 | public function rules() |
||
274 | |||
275 | /******************************************* |
||
276 | * SEARCH |
||
277 | *******************************************/ |
||
278 | |||
279 | /** |
||
280 | * @param ObjectAssociationQuery $value |
||
281 | * @inheritdoc |
||
282 | */ |
||
283 | public function getSearchKeywords($value, ElementInterface $element): string |
||
293 | |||
294 | /******************************************* |
||
295 | * VIEWS |
||
296 | *******************************************/ |
||
297 | |||
298 | /** |
||
299 | * @param ObjectAssociationQuery $value |
||
300 | * @inheritdoc |
||
301 | * @throws \Twig_Error_Loader |
||
302 | * @throws \yii\base\Exception |
||
303 | */ |
||
304 | public function getInputHtml($value, ElementInterface $element = null): string |
||
309 | |||
310 | /** |
||
311 | * @inheritdoc |
||
312 | * @throws \Twig_Error_Loader |
||
313 | * @throws \yii\base\Exception |
||
314 | */ |
||
315 | public function getSettingsHtml() |
||
319 | |||
320 | /******************************************* |
||
321 | * EVENTS |
||
322 | *******************************************/ |
||
323 | |||
324 | /** |
||
325 | * @inheritdoc |
||
326 | * @throws \Exception |
||
327 | */ |
||
328 | public function afterElementSave(ElementInterface $element, bool $isNew) |
||
337 | } |
||
338 |