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