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