Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/CustomField.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
5830940d | 9 | * (GenCodeChecksum:7f096c92af68ef9564675e3d708fbbe1) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the CustomField entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_CustomField extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_custom_field'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Unique Custom Field ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to civicrm_custom_group. | |
40 | * | |
41 | * @var int unsigned | |
42 | */ | |
43 | public $custom_group_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Variable name/programmatic handle for this group. | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $name; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Text for form field label (also friendly name for administering this custom property). | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $label; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Controls location of data storage in extended_data table. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $data_type; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * HTML types plus several built-in extended types. | |
68 | * | |
69 | * @var string | |
70 | */ | |
71 | public $html_type; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Use form_options.is_default for field_types which use options. | |
75 | * | |
76 | * @var string | |
77 | */ | |
78 | public $default_value; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Is a value required for this property. | |
82 | * | |
83 | * @var boolean | |
84 | */ | |
85 | public $is_required; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Is this property searchable. | |
89 | * | |
90 | * @var boolean | |
91 | */ | |
92 | public $is_searchable; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Is this property range searchable. | |
96 | * | |
97 | * @var boolean | |
98 | */ | |
99 | public $is_search_range; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Controls field display order within an extended property group. | |
103 | * | |
104 | * @var int | |
105 | */ | |
106 | public $weight; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * Description and/or help text to display before this field. | |
110 | * | |
111 | * @var text | |
112 | */ | |
113 | public $help_pre; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * Description and/or help text to display after this field. | |
117 | * | |
118 | * @var text | |
119 | */ | |
120 | public $help_post; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Optional format instructions for specific field types, like date types. | |
124 | * | |
125 | * @var string | |
126 | */ | |
127 | public $mask; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes | |
131 | * | |
132 | * @var string | |
133 | */ | |
134 | public $attributes; | |
c3fc2621 | 135 | |
e501603b TO |
136 | /** |
137 | * Optional scripting attributes for field. | |
138 | * | |
139 | * @var string | |
140 | */ | |
141 | public $javascript; | |
c3fc2621 | 142 | |
e501603b TO |
143 | /** |
144 | * Is this property active? | |
145 | * | |
146 | * @var boolean | |
147 | */ | |
148 | public $is_active; | |
c3fc2621 | 149 | |
e501603b TO |
150 | /** |
151 | * Is this property set by PHP Code? A code field is viewable but not editable | |
152 | * | |
153 | * @var boolean | |
154 | */ | |
155 | public $is_view; | |
c3fc2621 | 156 | |
e501603b TO |
157 | /** |
158 | * number of options per line for checkbox and radio | |
159 | * | |
160 | * @var int unsigned | |
161 | */ | |
162 | public $options_per_line; | |
c3fc2621 | 163 | |
e501603b TO |
164 | /** |
165 | * field length if alphanumeric | |
166 | * | |
167 | * @var int unsigned | |
168 | */ | |
169 | public $text_length; | |
c3fc2621 | 170 | |
e501603b TO |
171 | /** |
172 | * Date may be up to start_date_years years prior to the current date. | |
173 | * | |
174 | * @var int | |
175 | */ | |
176 | public $start_date_years; | |
c3fc2621 | 177 | |
e501603b TO |
178 | /** |
179 | * Date may be up to end_date_years years after the current date. | |
180 | * | |
181 | * @var int | |
182 | */ | |
183 | public $end_date_years; | |
c3fc2621 | 184 | |
e501603b TO |
185 | /** |
186 | * date format for custom date | |
187 | * | |
188 | * @var string | |
189 | */ | |
190 | public $date_format; | |
c3fc2621 | 191 | |
e501603b TO |
192 | /** |
193 | * time format for custom date | |
194 | * | |
195 | * @var int unsigned | |
196 | */ | |
197 | public $time_format; | |
c3fc2621 | 198 | |
e501603b TO |
199 | /** |
200 | * Number of columns in Note Field | |
201 | * | |
202 | * @var int unsigned | |
203 | */ | |
204 | public $note_columns; | |
c3fc2621 | 205 | |
e501603b TO |
206 | /** |
207 | * Number of rows in Note Field | |
208 | * | |
209 | * @var int unsigned | |
210 | */ | |
211 | public $note_rows; | |
c3fc2621 | 212 | |
e501603b TO |
213 | /** |
214 | * Name of the column that holds the values for this field. | |
215 | * | |
216 | * @var string | |
217 | */ | |
218 | public $column_name; | |
c3fc2621 | 219 | |
e501603b TO |
220 | /** |
221 | * For elements with options, the option group id that is used | |
222 | * | |
223 | * @var int unsigned | |
224 | */ | |
225 | public $option_group_id; | |
c3fc2621 | 226 | |
e501603b TO |
227 | /** |
228 | * Stores Contact Get API params contact reference custom fields. May be used for other filters in the future. | |
229 | * | |
230 | * @var string | |
231 | */ | |
232 | public $filter; | |
c3fc2621 | 233 | |
e501603b TO |
234 | /** |
235 | * Should the multi-record custom field values be displayed in tab table listing | |
236 | * | |
237 | * @var boolean | |
238 | */ | |
239 | public $in_selector; | |
c3fc2621 | 240 | |
e501603b | 241 | /** |
f41f0342 | 242 | * Class constructor. |
e501603b | 243 | */ |
c3fc2621 | 244 | public function __construct() { |
e501603b TO |
245 | $this->__table = 'civicrm_custom_field'; |
246 | parent::__construct(); | |
247 | } | |
c3fc2621 | 248 | |
e501603b | 249 | /** |
f41f0342 | 250 | * Returns foreign keys and entity references. |
e501603b TO |
251 | * |
252 | * @return array | |
253 | * [CRM_Core_Reference_Interface] | |
254 | */ | |
c3fc2621 | 255 | public static function getReferenceColumns() { |
346aaaba TO |
256 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
257 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 | 258 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'custom_group_id', 'civicrm_custom_group', 'id'); |
346aaaba | 259 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 260 | } |
346aaaba | 261 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 262 | } |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns all the column names of this table | |
266 | * | |
267 | * @return array | |
268 | */ | |
c3fc2621 | 269 | public static function &fields() { |
346aaaba | 270 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
271 | Civi::$statics[__CLASS__]['fields'] = [ |
272 | 'id' => [ | |
e501603b TO |
273 | 'name' => 'id', |
274 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 275 | 'title' => ts('Custom Field ID'), |
e501603b | 276 | 'description' => 'Unique Custom Field ID', |
c3fc2621 | 277 | 'required' => TRUE, |
522a26c9 | 278 | 'table_name' => 'civicrm_custom_field', |
279 | 'entity' => 'CustomField', | |
280 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 281 | 'localizable' => 0, |
c3fc2621 CW |
282 | ], |
283 | 'custom_group_id' => [ | |
e501603b TO |
284 | 'name' => 'custom_group_id', |
285 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 286 | 'title' => ts('Custom Group'), |
e501603b | 287 | 'description' => 'FK to civicrm_custom_group.', |
c3fc2621 | 288 | 'required' => TRUE, |
522a26c9 | 289 | 'table_name' => 'civicrm_custom_field', |
290 | 'entity' => 'CustomField', | |
291 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 292 | 'localizable' => 0, |
e501603b | 293 | 'FKClassName' => 'CRM_Core_DAO_CustomGroup', |
c3fc2621 | 294 | 'html' => [ |
e501603b | 295 | 'type' => 'Select', |
c3fc2621 CW |
296 | ], |
297 | 'pseudoconstant' => [ | |
e501603b TO |
298 | 'table' => 'civicrm_custom_group', |
299 | 'keyColumn' => 'id', | |
300 | 'labelColumn' => 'title', | |
c3fc2621 CW |
301 | ] |
302 | ], | |
303 | 'name' => [ | |
e501603b TO |
304 | 'name' => 'name', |
305 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 306 | 'title' => ts('Custom Field Name'), |
e501603b TO |
307 | 'description' => 'Variable name/programmatic handle for this group.', |
308 | 'maxlength' => 64, | |
309 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 310 | 'table_name' => 'civicrm_custom_field', |
311 | 'entity' => 'CustomField', | |
312 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 313 | 'localizable' => 0, |
c3fc2621 CW |
314 | ], |
315 | 'label' => [ | |
e501603b TO |
316 | 'name' => 'label', |
317 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 318 | 'title' => ts('Custom Field Label'), |
e501603b | 319 | 'description' => 'Text for form field label (also friendly name for administering this custom property).', |
c3fc2621 | 320 | 'required' => TRUE, |
e501603b TO |
321 | 'maxlength' => 255, |
322 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 323 | 'table_name' => 'civicrm_custom_field', |
324 | 'entity' => 'CustomField', | |
325 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 326 | 'localizable' => 1, |
c3fc2621 CW |
327 | ], |
328 | 'data_type' => [ | |
e501603b TO |
329 | 'name' => 'data_type', |
330 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 331 | 'title' => ts('Custom Field Data Type'), |
e501603b | 332 | 'description' => 'Controls location of data storage in extended_data table.', |
c3fc2621 | 333 | 'required' => TRUE, |
e501603b TO |
334 | 'maxlength' => 16, |
335 | 'size' => CRM_Utils_Type::TWELVE, | |
522a26c9 | 336 | 'table_name' => 'civicrm_custom_field', |
337 | 'entity' => 'CustomField', | |
338 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 339 | 'localizable' => 0, |
c3fc2621 | 340 | 'html' => [ |
e501603b | 341 | 'type' => 'Select', |
c3fc2621 CW |
342 | ], |
343 | 'pseudoconstant' => [ | |
e501603b | 344 | 'callback' => 'CRM_Core_BAO_CustomField::dataType', |
c3fc2621 CW |
345 | ] |
346 | ], | |
347 | 'html_type' => [ | |
e501603b TO |
348 | 'name' => 'html_type', |
349 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 350 | 'title' => ts('Custom Field HTML Type'), |
e501603b | 351 | 'description' => 'HTML types plus several built-in extended types.', |
c3fc2621 | 352 | 'required' => TRUE, |
e501603b TO |
353 | 'maxlength' => 32, |
354 | 'size' => CRM_Utils_Type::MEDIUM, | |
522a26c9 | 355 | 'table_name' => 'civicrm_custom_field', |
356 | 'entity' => 'CustomField', | |
357 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 358 | 'localizable' => 0, |
c3fc2621 | 359 | 'pseudoconstant' => [ |
e501603b | 360 | 'callback' => 'CRM_Core_SelectValues::customHtmlType', |
c3fc2621 CW |
361 | ] |
362 | ], | |
363 | 'default_value' => [ | |
e501603b TO |
364 | 'name' => 'default_value', |
365 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 366 | 'title' => ts('Custom Field Default'), |
e501603b TO |
367 | 'description' => 'Use form_options.is_default for field_types which use options.', |
368 | 'maxlength' => 255, | |
369 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 370 | 'table_name' => 'civicrm_custom_field', |
371 | 'entity' => 'CustomField', | |
372 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 373 | 'localizable' => 0, |
c3fc2621 CW |
374 | ], |
375 | 'is_required' => [ | |
e501603b TO |
376 | 'name' => 'is_required', |
377 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 378 | 'title' => ts('Custom Field Is Required?'), |
e501603b | 379 | 'description' => 'Is a value required for this property.', |
522a26c9 | 380 | 'table_name' => 'civicrm_custom_field', |
381 | 'entity' => 'CustomField', | |
382 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 383 | 'localizable' => 0, |
c3fc2621 CW |
384 | ], |
385 | 'is_searchable' => [ | |
e501603b TO |
386 | 'name' => 'is_searchable', |
387 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 388 | 'title' => ts('Allow Searching on Field?'), |
e501603b | 389 | 'description' => 'Is this property searchable.', |
522a26c9 | 390 | 'table_name' => 'civicrm_custom_field', |
391 | 'entity' => 'CustomField', | |
392 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 393 | 'localizable' => 0, |
c3fc2621 CW |
394 | ], |
395 | 'is_search_range' => [ | |
e501603b TO |
396 | 'name' => 'is_search_range', |
397 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 398 | 'title' => ts('Search as a Range'), |
e501603b | 399 | 'description' => 'Is this property range searchable.', |
522a26c9 | 400 | 'table_name' => 'civicrm_custom_field', |
401 | 'entity' => 'CustomField', | |
402 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 403 | 'localizable' => 0, |
c3fc2621 CW |
404 | ], |
405 | 'weight' => [ | |
e501603b TO |
406 | 'name' => 'weight', |
407 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 408 | 'title' => ts('Order'), |
e501603b | 409 | 'description' => 'Controls field display order within an extended property group.', |
c3fc2621 | 410 | 'required' => TRUE, |
e501603b | 411 | 'default' => '1', |
522a26c9 | 412 | 'table_name' => 'civicrm_custom_field', |
413 | 'entity' => 'CustomField', | |
414 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 415 | 'localizable' => 0, |
c3fc2621 CW |
416 | ], |
417 | 'help_pre' => [ | |
e501603b TO |
418 | 'name' => 'help_pre', |
419 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 420 | 'title' => ts('Custom Field Pre Text'), |
e501603b | 421 | 'description' => 'Description and/or help text to display before this field.', |
522a26c9 | 422 | 'table_name' => 'civicrm_custom_field', |
423 | 'entity' => 'CustomField', | |
424 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 425 | 'localizable' => 1, |
c3fc2621 CW |
426 | ], |
427 | 'help_post' => [ | |
e501603b TO |
428 | 'name' => 'help_post', |
429 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 430 | 'title' => ts('Custom Field Post Text'), |
e501603b | 431 | 'description' => 'Description and/or help text to display after this field.', |
522a26c9 | 432 | 'table_name' => 'civicrm_custom_field', |
433 | 'entity' => 'CustomField', | |
434 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 435 | 'localizable' => 1, |
c3fc2621 CW |
436 | ], |
437 | 'mask' => [ | |
e501603b TO |
438 | 'name' => 'mask', |
439 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 440 | 'title' => ts('Custom Field Formatting'), |
e501603b TO |
441 | 'description' => 'Optional format instructions for specific field types, like date types.', |
442 | 'maxlength' => 64, | |
443 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 444 | 'table_name' => 'civicrm_custom_field', |
445 | 'entity' => 'CustomField', | |
446 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 447 | 'localizable' => 0, |
c3fc2621 CW |
448 | ], |
449 | 'attributes' => [ | |
e501603b TO |
450 | 'name' => 'attributes', |
451 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 452 | 'title' => ts('Custom Field Attributes'), |
e501603b TO |
453 | 'description' => 'Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes', |
454 | 'maxlength' => 255, | |
455 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 456 | 'table_name' => 'civicrm_custom_field', |
457 | 'entity' => 'CustomField', | |
458 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 459 | 'localizable' => 0, |
c3fc2621 CW |
460 | ], |
461 | 'javascript' => [ | |
e501603b TO |
462 | 'name' => 'javascript', |
463 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 464 | 'title' => ts('Custom Field Javascript'), |
e501603b TO |
465 | 'description' => 'Optional scripting attributes for field.', |
466 | 'maxlength' => 255, | |
467 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 468 | 'table_name' => 'civicrm_custom_field', |
469 | 'entity' => 'CustomField', | |
470 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 471 | 'localizable' => 0, |
c3fc2621 CW |
472 | ], |
473 | 'is_active' => [ | |
e501603b TO |
474 | 'name' => 'is_active', |
475 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 476 | 'title' => ts('Custom Field Is Active?'), |
e501603b | 477 | 'description' => 'Is this property active?', |
110f4343 | 478 | 'default' => '1', |
522a26c9 | 479 | 'table_name' => 'civicrm_custom_field', |
480 | 'entity' => 'CustomField', | |
481 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 482 | 'localizable' => 0, |
c3fc2621 CW |
483 | ], |
484 | 'is_view' => [ | |
e501603b TO |
485 | 'name' => 'is_view', |
486 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 487 | 'title' => ts('Field is Viewable'), |
e501603b | 488 | 'description' => 'Is this property set by PHP Code? A code field is viewable but not editable', |
522a26c9 | 489 | 'table_name' => 'civicrm_custom_field', |
490 | 'entity' => 'CustomField', | |
491 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 492 | 'localizable' => 0, |
c3fc2621 CW |
493 | ], |
494 | 'options_per_line' => [ | |
e501603b TO |
495 | 'name' => 'options_per_line', |
496 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 497 | 'title' => ts('Field Options Per Line'), |
e501603b | 498 | 'description' => 'number of options per line for checkbox and radio', |
522a26c9 | 499 | 'table_name' => 'civicrm_custom_field', |
500 | 'entity' => 'CustomField', | |
501 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 502 | 'localizable' => 0, |
c3fc2621 CW |
503 | ], |
504 | 'text_length' => [ | |
e501603b TO |
505 | 'name' => 'text_length', |
506 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 507 | 'title' => ts('Field Length'), |
e501603b | 508 | 'description' => 'field length if alphanumeric', |
522a26c9 | 509 | 'table_name' => 'civicrm_custom_field', |
510 | 'entity' => 'CustomField', | |
511 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 512 | 'localizable' => 0, |
c3fc2621 CW |
513 | ], |
514 | 'start_date_years' => [ | |
e501603b TO |
515 | 'name' => 'start_date_years', |
516 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 517 | 'title' => ts('Field Start Date'), |
e501603b | 518 | 'description' => 'Date may be up to start_date_years years prior to the current date.', |
522a26c9 | 519 | 'table_name' => 'civicrm_custom_field', |
520 | 'entity' => 'CustomField', | |
521 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 522 | 'localizable' => 0, |
c3fc2621 CW |
523 | ], |
524 | 'end_date_years' => [ | |
e501603b TO |
525 | 'name' => 'end_date_years', |
526 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 527 | 'title' => ts('Field End Date'), |
e501603b | 528 | 'description' => 'Date may be up to end_date_years years after the current date.', |
522a26c9 | 529 | 'table_name' => 'civicrm_custom_field', |
530 | 'entity' => 'CustomField', | |
531 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 532 | 'localizable' => 0, |
c3fc2621 CW |
533 | ], |
534 | 'date_format' => [ | |
e501603b TO |
535 | 'name' => 'date_format', |
536 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 537 | 'title' => ts('Field Data Format'), |
e501603b TO |
538 | 'description' => 'date format for custom date', |
539 | 'maxlength' => 64, | |
540 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 541 | 'table_name' => 'civicrm_custom_field', |
542 | 'entity' => 'CustomField', | |
543 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 544 | 'localizable' => 0, |
c3fc2621 CW |
545 | ], |
546 | 'time_format' => [ | |
e501603b TO |
547 | 'name' => 'time_format', |
548 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 549 | 'title' => ts('Field Time Format'), |
e501603b | 550 | 'description' => 'time format for custom date', |
522a26c9 | 551 | 'table_name' => 'civicrm_custom_field', |
552 | 'entity' => 'CustomField', | |
553 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 554 | 'localizable' => 0, |
c3fc2621 CW |
555 | ], |
556 | 'note_columns' => [ | |
e501603b TO |
557 | 'name' => 'note_columns', |
558 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 559 | 'title' => ts('Field Note Columns'), |
e501603b | 560 | 'description' => ' Number of columns in Note Field ', |
522a26c9 | 561 | 'table_name' => 'civicrm_custom_field', |
562 | 'entity' => 'CustomField', | |
563 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 564 | 'localizable' => 0, |
c3fc2621 CW |
565 | ], |
566 | 'note_rows' => [ | |
e501603b TO |
567 | 'name' => 'note_rows', |
568 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 569 | 'title' => ts('Field Note Rows'), |
e501603b | 570 | 'description' => ' Number of rows in Note Field ', |
522a26c9 | 571 | 'table_name' => 'civicrm_custom_field', |
572 | 'entity' => 'CustomField', | |
573 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 574 | 'localizable' => 0, |
c3fc2621 CW |
575 | ], |
576 | 'column_name' => [ | |
e501603b TO |
577 | 'name' => 'column_name', |
578 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 579 | 'title' => ts('Field Column Name'), |
e501603b TO |
580 | 'description' => 'Name of the column that holds the values for this field.', |
581 | 'maxlength' => 255, | |
582 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 583 | 'table_name' => 'civicrm_custom_field', |
584 | 'entity' => 'CustomField', | |
585 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 586 | 'localizable' => 0, |
c3fc2621 CW |
587 | ], |
588 | 'option_group_id' => [ | |
e501603b TO |
589 | 'name' => 'option_group_id', |
590 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 591 | 'title' => ts('Field Option Group'), |
e501603b | 592 | 'description' => 'For elements with options, the option group id that is used', |
522a26c9 | 593 | 'table_name' => 'civicrm_custom_field', |
594 | 'entity' => 'CustomField', | |
595 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 596 | 'localizable' => 0, |
5830940d MM |
597 | 'pseudoconstant' => [ |
598 | 'table' => 'civicrm_option_group', | |
599 | 'keyColumn' => 'id', | |
600 | 'labelColumn' => 'title', | |
601 | ] | |
c3fc2621 CW |
602 | ], |
603 | 'filter' => [ | |
e501603b TO |
604 | 'name' => 'filter', |
605 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 606 | 'title' => ts('Field Filter'), |
e501603b TO |
607 | 'description' => 'Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.', |
608 | 'maxlength' => 255, | |
609 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 610 | 'table_name' => 'civicrm_custom_field', |
611 | 'entity' => 'CustomField', | |
612 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 613 | 'localizable' => 0, |
c3fc2621 CW |
614 | ], |
615 | 'in_selector' => [ | |
e501603b TO |
616 | 'name' => 'in_selector', |
617 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 618 | 'title' => ts('Field Display'), |
e501603b | 619 | 'description' => 'Should the multi-record custom field values be displayed in tab table listing', |
522a26c9 | 620 | 'table_name' => 'civicrm_custom_field', |
621 | 'entity' => 'CustomField', | |
622 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 623 | 'localizable' => 0, |
c3fc2621 CW |
624 | ], |
625 | ]; | |
346aaaba | 626 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 627 | } |
346aaaba | 628 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 629 | } |
c3fc2621 | 630 | |
e501603b | 631 | /** |
bd8e0b14 | 632 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
633 | * |
634 | * @return array | |
bd8e0b14 | 635 | * Array(string $name => string $uniqueName). |
e501603b | 636 | */ |
c3fc2621 | 637 | public static function &fieldKeys() { |
bd8e0b14 TO |
638 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
639 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 640 | } |
bd8e0b14 | 641 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 642 | } |
c3fc2621 | 643 | |
e501603b TO |
644 | /** |
645 | * Returns the names of this table | |
646 | * | |
647 | * @return string | |
648 | */ | |
c3fc2621 | 649 | public static function getTableName() { |
e501603b TO |
650 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
651 | } | |
c3fc2621 | 652 | |
e501603b TO |
653 | /** |
654 | * Returns if this table needs to be logged | |
655 | * | |
c3fc2621 | 656 | * @return bool |
e501603b | 657 | */ |
c3fc2621 | 658 | public function getLog() { |
e501603b TO |
659 | return self::$_log; |
660 | } | |
c3fc2621 | 661 | |
e501603b TO |
662 | /** |
663 | * Returns the list of fields that can be imported | |
664 | * | |
665 | * @param bool $prefix | |
666 | * | |
667 | * @return array | |
668 | */ | |
c3fc2621 CW |
669 | public static function &import($prefix = FALSE) { |
670 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_field', $prefix, []); | |
60808919 | 671 | return $r; |
e501603b | 672 | } |
c3fc2621 | 673 | |
e501603b TO |
674 | /** |
675 | * Returns the list of fields that can be exported | |
676 | * | |
677 | * @param bool $prefix | |
678 | * | |
679 | * @return array | |
680 | */ | |
c3fc2621 CW |
681 | public static function &export($prefix = FALSE) { |
682 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_field', $prefix, []); | |
60808919 | 683 | return $r; |
e501603b | 684 | } |
c3fc2621 | 685 | |
e7a6b91a AS |
686 | /** |
687 | * Returns the list of indices | |
c3fc2621 CW |
688 | * |
689 | * @param bool $localize | |
690 | * | |
691 | * @return array | |
e7a6b91a AS |
692 | */ |
693 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
694 | $indices = [ |
695 | 'UI_label_custom_group_id' => [ | |
e7a6b91a | 696 | 'name' => 'UI_label_custom_group_id', |
c3fc2621 | 697 | 'field' => [ |
e7a6b91a AS |
698 | 0 => 'label', |
699 | 1 => 'custom_group_id', | |
c3fc2621 CW |
700 | ], |
701 | 'localizable' => TRUE, | |
702 | 'unique' => TRUE, | |
e7a6b91a | 703 | 'sig' => 'civicrm_custom_field::1::label::custom_group_id', |
c3fc2621 CW |
704 | ], |
705 | 'UI_name_custom_group_id' => [ | |
e7a6b91a | 706 | 'name' => 'UI_name_custom_group_id', |
c3fc2621 | 707 | 'field' => [ |
e7a6b91a AS |
708 | 0 => 'name', |
709 | 1 => 'custom_group_id', | |
c3fc2621 CW |
710 | ], |
711 | 'localizable' => FALSE, | |
712 | 'unique' => TRUE, | |
e7a6b91a | 713 | 'sig' => 'civicrm_custom_field::1::name::custom_group_id', |
c3fc2621 CW |
714 | ], |
715 | ]; | |
e7a6b91a AS |
716 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
717 | } | |
c3fc2621 | 718 | |
e501603b | 719 | } |