Merge pull request #12583 from omarabuhussein/dev/core#288
[civicrm-core.git] / CRM / Core / DAO / CustomField.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/CustomField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:a1a27e2af4724a92f37a959ee359428b)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the CustomField entity.
f41f0342 14 */
e501603b 15class 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');
2b216479 259 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'option_group_id', 'civicrm_option_group', 'id');
346aaaba 260 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 261 }
346aaaba 262 return Civi::$statics[__CLASS__]['links'];
e501603b 263 }
c3fc2621 264
e501603b
TO
265 /**
266 * Returns all the column names of this table
267 *
268 * @return array
269 */
c3fc2621 270 public static function &fields() {
346aaaba 271 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
272 Civi::$statics[__CLASS__]['fields'] = [
273 'id' => [
e501603b
TO
274 'name' => 'id',
275 'type' => CRM_Utils_Type::T_INT,
c3fc2621 276 'title' => ts('Custom Field ID'),
215b423e 277 'description' => ts('Unique Custom Field ID'),
c3fc2621 278 'required' => TRUE,
522a26c9 279 'table_name' => 'civicrm_custom_field',
280 'entity' => 'CustomField',
281 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 282 'localizable' => 0,
c3fc2621
CW
283 ],
284 'custom_group_id' => [
e501603b
TO
285 'name' => 'custom_group_id',
286 'type' => CRM_Utils_Type::T_INT,
c3fc2621 287 'title' => ts('Custom Group'),
215b423e 288 'description' => ts('FK to civicrm_custom_group.'),
c3fc2621 289 'required' => TRUE,
522a26c9 290 'table_name' => 'civicrm_custom_field',
291 'entity' => 'CustomField',
292 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 293 'localizable' => 0,
e501603b 294 'FKClassName' => 'CRM_Core_DAO_CustomGroup',
c3fc2621 295 'html' => [
e501603b 296 'type' => 'Select',
c3fc2621
CW
297 ],
298 'pseudoconstant' => [
e501603b
TO
299 'table' => 'civicrm_custom_group',
300 'keyColumn' => 'id',
301 'labelColumn' => 'title',
c3fc2621
CW
302 ]
303 ],
304 'name' => [
e501603b
TO
305 'name' => 'name',
306 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 307 'title' => ts('Custom Field Name'),
215b423e 308 'description' => ts('Variable name/programmatic handle for this group.'),
e501603b
TO
309 'maxlength' => 64,
310 'size' => CRM_Utils_Type::BIG,
522a26c9 311 'table_name' => 'civicrm_custom_field',
312 'entity' => 'CustomField',
313 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 314 'localizable' => 0,
c3fc2621
CW
315 ],
316 'label' => [
e501603b
TO
317 'name' => 'label',
318 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 319 'title' => ts('Custom Field Label'),
215b423e 320 'description' => ts('Text for form field label (also friendly name for administering this custom property).'),
c3fc2621 321 'required' => TRUE,
e501603b
TO
322 'maxlength' => 255,
323 'size' => CRM_Utils_Type::HUGE,
522a26c9 324 'table_name' => 'civicrm_custom_field',
325 'entity' => 'CustomField',
326 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 327 'localizable' => 1,
c3fc2621
CW
328 ],
329 'data_type' => [
e501603b
TO
330 'name' => 'data_type',
331 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 332 'title' => ts('Custom Field Data Type'),
215b423e 333 'description' => ts('Controls location of data storage in extended_data table.'),
c3fc2621 334 'required' => TRUE,
e501603b
TO
335 'maxlength' => 16,
336 'size' => CRM_Utils_Type::TWELVE,
522a26c9 337 'table_name' => 'civicrm_custom_field',
338 'entity' => 'CustomField',
339 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 340 'localizable' => 0,
c3fc2621 341 'html' => [
e501603b 342 'type' => 'Select',
c3fc2621
CW
343 ],
344 'pseudoconstant' => [
e501603b 345 'callback' => 'CRM_Core_BAO_CustomField::dataType',
c3fc2621
CW
346 ]
347 ],
348 'html_type' => [
e501603b
TO
349 'name' => 'html_type',
350 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 351 'title' => ts('Custom Field HTML Type'),
215b423e 352 'description' => ts('HTML types plus several built-in extended types.'),
c3fc2621 353 'required' => TRUE,
e501603b
TO
354 'maxlength' => 32,
355 'size' => CRM_Utils_Type::MEDIUM,
522a26c9 356 'table_name' => 'civicrm_custom_field',
357 'entity' => 'CustomField',
358 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 359 'localizable' => 0,
c3fc2621 360 'pseudoconstant' => [
e501603b 361 'callback' => 'CRM_Core_SelectValues::customHtmlType',
c3fc2621
CW
362 ]
363 ],
364 'default_value' => [
e501603b
TO
365 'name' => 'default_value',
366 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 367 'title' => ts('Custom Field Default'),
215b423e 368 'description' => ts('Use form_options.is_default for field_types which use options.'),
e501603b
TO
369 'maxlength' => 255,
370 'size' => CRM_Utils_Type::HUGE,
522a26c9 371 'table_name' => 'civicrm_custom_field',
372 'entity' => 'CustomField',
373 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 374 'localizable' => 0,
c3fc2621
CW
375 ],
376 'is_required' => [
e501603b
TO
377 'name' => 'is_required',
378 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 379 'title' => ts('Custom Field Is Required?'),
215b423e 380 'description' => ts('Is a value required for this property.'),
45a83e42 381 'default' => '0',
522a26c9 382 'table_name' => 'civicrm_custom_field',
383 'entity' => 'CustomField',
384 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 385 'localizable' => 0,
c3fc2621
CW
386 ],
387 'is_searchable' => [
e501603b
TO
388 'name' => 'is_searchable',
389 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 390 'title' => ts('Allow Searching on Field?'),
215b423e 391 'description' => ts('Is this property searchable.'),
45a83e42 392 'default' => '0',
522a26c9 393 'table_name' => 'civicrm_custom_field',
394 'entity' => 'CustomField',
395 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 396 'localizable' => 0,
c3fc2621
CW
397 ],
398 'is_search_range' => [
e501603b
TO
399 'name' => 'is_search_range',
400 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 401 'title' => ts('Search as a Range'),
215b423e 402 'description' => ts('Is this property range searchable.'),
45a83e42 403 'default' => '0',
522a26c9 404 'table_name' => 'civicrm_custom_field',
405 'entity' => 'CustomField',
406 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 407 'localizable' => 0,
c3fc2621
CW
408 ],
409 'weight' => [
e501603b
TO
410 'name' => 'weight',
411 'type' => CRM_Utils_Type::T_INT,
c3fc2621 412 'title' => ts('Order'),
215b423e 413 'description' => ts('Controls field display order within an extended property group.'),
c3fc2621 414 'required' => TRUE,
e501603b 415 'default' => '1',
522a26c9 416 'table_name' => 'civicrm_custom_field',
417 'entity' => 'CustomField',
418 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 419 'localizable' => 0,
c3fc2621
CW
420 ],
421 'help_pre' => [
e501603b
TO
422 'name' => 'help_pre',
423 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 424 'title' => ts('Custom Field Pre Text'),
215b423e 425 'description' => ts('Description and/or help text to display before this field.'),
522a26c9 426 'table_name' => 'civicrm_custom_field',
427 'entity' => 'CustomField',
428 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 429 'localizable' => 1,
c3fc2621
CW
430 ],
431 'help_post' => [
e501603b
TO
432 'name' => 'help_post',
433 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 434 'title' => ts('Custom Field Post Text'),
215b423e 435 'description' => ts('Description and/or help text to display after this field.'),
522a26c9 436 'table_name' => 'civicrm_custom_field',
437 'entity' => 'CustomField',
438 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 439 'localizable' => 1,
c3fc2621
CW
440 ],
441 'mask' => [
e501603b
TO
442 'name' => 'mask',
443 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 444 'title' => ts('Custom Field Formatting'),
215b423e 445 'description' => ts('Optional format instructions for specific field types, like date types.'),
e501603b
TO
446 'maxlength' => 64,
447 'size' => CRM_Utils_Type::BIG,
522a26c9 448 'table_name' => 'civicrm_custom_field',
449 'entity' => 'CustomField',
450 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 451 'localizable' => 0,
c3fc2621
CW
452 ],
453 'attributes' => [
e501603b
TO
454 'name' => 'attributes',
455 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 456 'title' => ts('Custom Field Attributes'),
215b423e 457 'description' => ts('Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes'),
e501603b
TO
458 'maxlength' => 255,
459 'size' => CRM_Utils_Type::HUGE,
522a26c9 460 'table_name' => 'civicrm_custom_field',
461 'entity' => 'CustomField',
462 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 463 'localizable' => 0,
c3fc2621
CW
464 ],
465 'javascript' => [
e501603b
TO
466 'name' => 'javascript',
467 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 468 'title' => ts('Custom Field Javascript'),
215b423e 469 'description' => ts('Optional scripting attributes for field.'),
e501603b
TO
470 'maxlength' => 255,
471 'size' => CRM_Utils_Type::HUGE,
522a26c9 472 'table_name' => 'civicrm_custom_field',
473 'entity' => 'CustomField',
474 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 475 'localizable' => 0,
c3fc2621
CW
476 ],
477 'is_active' => [
e501603b
TO
478 'name' => 'is_active',
479 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 480 'title' => ts('Custom Field Is Active?'),
215b423e 481 'description' => ts('Is this property active?'),
110f4343 482 'default' => '1',
522a26c9 483 'table_name' => 'civicrm_custom_field',
484 'entity' => 'CustomField',
485 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 486 'localizable' => 0,
c3fc2621
CW
487 ],
488 'is_view' => [
e501603b
TO
489 'name' => 'is_view',
490 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 491 'title' => ts('Field is Viewable'),
215b423e 492 'description' => ts('Is this property set by PHP Code? A code field is viewable but not editable'),
45a83e42 493 'default' => '0',
522a26c9 494 'table_name' => 'civicrm_custom_field',
495 'entity' => 'CustomField',
496 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 497 'localizable' => 0,
c3fc2621
CW
498 ],
499 'options_per_line' => [
e501603b
TO
500 'name' => 'options_per_line',
501 'type' => CRM_Utils_Type::T_INT,
c3fc2621 502 'title' => ts('Field Options Per Line'),
215b423e 503 'description' => ts('number of options per line for checkbox and radio'),
522a26c9 504 'table_name' => 'civicrm_custom_field',
505 'entity' => 'CustomField',
506 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 507 'localizable' => 0,
c3fc2621
CW
508 ],
509 'text_length' => [
e501603b
TO
510 'name' => 'text_length',
511 'type' => CRM_Utils_Type::T_INT,
c3fc2621 512 'title' => ts('Field Length'),
215b423e 513 'description' => ts('field length if alphanumeric'),
522a26c9 514 'table_name' => 'civicrm_custom_field',
515 'entity' => 'CustomField',
516 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 517 'localizable' => 0,
c3fc2621
CW
518 ],
519 'start_date_years' => [
e501603b
TO
520 'name' => 'start_date_years',
521 'type' => CRM_Utils_Type::T_INT,
c3fc2621 522 'title' => ts('Field Start Date'),
215b423e 523 'description' => ts('Date may be up to start_date_years years prior to the current date.'),
522a26c9 524 'table_name' => 'civicrm_custom_field',
525 'entity' => 'CustomField',
526 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 527 'localizable' => 0,
c3fc2621
CW
528 ],
529 'end_date_years' => [
e501603b
TO
530 'name' => 'end_date_years',
531 'type' => CRM_Utils_Type::T_INT,
c3fc2621 532 'title' => ts('Field End Date'),
215b423e 533 'description' => ts('Date may be up to end_date_years years after the current date.'),
522a26c9 534 'table_name' => 'civicrm_custom_field',
535 'entity' => 'CustomField',
536 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 537 'localizable' => 0,
c3fc2621
CW
538 ],
539 'date_format' => [
e501603b
TO
540 'name' => 'date_format',
541 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 542 'title' => ts('Field Data Format'),
215b423e 543 'description' => ts('date format for custom date'),
e501603b
TO
544 'maxlength' => 64,
545 'size' => CRM_Utils_Type::BIG,
522a26c9 546 'table_name' => 'civicrm_custom_field',
547 'entity' => 'CustomField',
548 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 549 'localizable' => 0,
c3fc2621
CW
550 ],
551 'time_format' => [
e501603b
TO
552 'name' => 'time_format',
553 'type' => CRM_Utils_Type::T_INT,
c3fc2621 554 'title' => ts('Field Time Format'),
215b423e 555 'description' => ts('time format for custom date'),
522a26c9 556 'table_name' => 'civicrm_custom_field',
557 'entity' => 'CustomField',
558 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 559 'localizable' => 0,
c3fc2621
CW
560 ],
561 'note_columns' => [
e501603b
TO
562 'name' => 'note_columns',
563 'type' => CRM_Utils_Type::T_INT,
c3fc2621 564 'title' => ts('Field Note Columns'),
215b423e 565 'description' => ts(' Number of columns in Note Field '),
522a26c9 566 'table_name' => 'civicrm_custom_field',
567 'entity' => 'CustomField',
568 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 569 'localizable' => 0,
c3fc2621
CW
570 ],
571 'note_rows' => [
e501603b
TO
572 'name' => 'note_rows',
573 'type' => CRM_Utils_Type::T_INT,
c3fc2621 574 'title' => ts('Field Note Rows'),
215b423e 575 'description' => ts(' Number of rows in Note Field '),
522a26c9 576 'table_name' => 'civicrm_custom_field',
577 'entity' => 'CustomField',
578 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 579 'localizable' => 0,
c3fc2621
CW
580 ],
581 'column_name' => [
e501603b
TO
582 'name' => 'column_name',
583 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 584 'title' => ts('Field Column Name'),
215b423e 585 'description' => ts('Name of the column that holds the values for this field.'),
e501603b
TO
586 'maxlength' => 255,
587 'size' => CRM_Utils_Type::HUGE,
522a26c9 588 'table_name' => 'civicrm_custom_field',
589 'entity' => 'CustomField',
590 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 591 'localizable' => 0,
c3fc2621
CW
592 ],
593 'option_group_id' => [
e501603b
TO
594 'name' => 'option_group_id',
595 'type' => CRM_Utils_Type::T_INT,
c3fc2621 596 'title' => ts('Field Option Group'),
215b423e 597 'description' => ts('For elements with options, the option group id that is used'),
522a26c9 598 'table_name' => 'civicrm_custom_field',
599 'entity' => 'CustomField',
600 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 601 'localizable' => 0,
2b216479 602 'FKClassName' => 'CRM_Core_DAO_OptionGroup',
5830940d
MM
603 'pseudoconstant' => [
604 'table' => 'civicrm_option_group',
605 'keyColumn' => 'id',
606 'labelColumn' => 'title',
607 ]
c3fc2621
CW
608 ],
609 'filter' => [
e501603b
TO
610 'name' => 'filter',
611 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 612 'title' => ts('Field Filter'),
215b423e 613 'description' => ts('Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.'),
e501603b
TO
614 'maxlength' => 255,
615 'size' => CRM_Utils_Type::HUGE,
522a26c9 616 'table_name' => 'civicrm_custom_field',
617 'entity' => 'CustomField',
618 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 619 'localizable' => 0,
c3fc2621
CW
620 ],
621 'in_selector' => [
e501603b
TO
622 'name' => 'in_selector',
623 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 624 'title' => ts('Field Display'),
215b423e 625 'description' => ts('Should the multi-record custom field values be displayed in tab table listing'),
45a83e42 626 'default' => '0',
522a26c9 627 'table_name' => 'civicrm_custom_field',
628 'entity' => 'CustomField',
629 'bao' => 'CRM_Core_BAO_CustomField',
6a7e5e5d 630 'localizable' => 0,
c3fc2621
CW
631 ],
632 ];
346aaaba 633 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 634 }
346aaaba 635 return Civi::$statics[__CLASS__]['fields'];
e501603b 636 }
c3fc2621 637
e501603b 638 /**
bd8e0b14 639 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
640 *
641 * @return array
bd8e0b14 642 * Array(string $name => string $uniqueName).
e501603b 643 */
c3fc2621 644 public static function &fieldKeys() {
bd8e0b14
TO
645 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
646 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 647 }
bd8e0b14 648 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 649 }
c3fc2621 650
e501603b
TO
651 /**
652 * Returns the names of this table
653 *
654 * @return string
655 */
c3fc2621 656 public static function getTableName() {
e501603b
TO
657 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
658 }
c3fc2621 659
e501603b
TO
660 /**
661 * Returns if this table needs to be logged
662 *
c3fc2621 663 * @return bool
e501603b 664 */
c3fc2621 665 public function getLog() {
e501603b
TO
666 return self::$_log;
667 }
c3fc2621 668
e501603b
TO
669 /**
670 * Returns the list of fields that can be imported
671 *
672 * @param bool $prefix
673 *
674 * @return array
675 */
c3fc2621
CW
676 public static function &import($prefix = FALSE) {
677 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_field', $prefix, []);
60808919 678 return $r;
e501603b 679 }
c3fc2621 680
e501603b
TO
681 /**
682 * Returns the list of fields that can be exported
683 *
684 * @param bool $prefix
685 *
686 * @return array
687 */
c3fc2621
CW
688 public static function &export($prefix = FALSE) {
689 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_field', $prefix, []);
60808919 690 return $r;
e501603b 691 }
c3fc2621 692
e7a6b91a
AS
693 /**
694 * Returns the list of indices
c3fc2621
CW
695 *
696 * @param bool $localize
697 *
698 * @return array
e7a6b91a
AS
699 */
700 public static function indices($localize = TRUE) {
c3fc2621
CW
701 $indices = [
702 'UI_label_custom_group_id' => [
e7a6b91a 703 'name' => 'UI_label_custom_group_id',
c3fc2621 704 'field' => [
e7a6b91a
AS
705 0 => 'label',
706 1 => 'custom_group_id',
c3fc2621
CW
707 ],
708 'localizable' => TRUE,
709 'unique' => TRUE,
e7a6b91a 710 'sig' => 'civicrm_custom_field::1::label::custom_group_id',
c3fc2621
CW
711 ],
712 'UI_name_custom_group_id' => [
e7a6b91a 713 'name' => 'UI_name_custom_group_id',
c3fc2621 714 'field' => [
e7a6b91a
AS
715 0 => 'name',
716 1 => 'custom_group_id',
c3fc2621
CW
717 ],
718 'localizable' => FALSE,
719 'unique' => TRUE,
e7a6b91a 720 'sig' => 'civicrm_custom_field::1::name::custom_group_id',
c3fc2621
CW
721 ],
722 ];
e7a6b91a
AS
723 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
724 }
c3fc2621 725
e501603b 726}