Commit | Line | Data |
---|---|---|
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 | |
a9d0587b | 9 | * (GenCodeChecksum:30f1deaf5c81a0f9cffb0219507d2e4f) |
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 | */ | |
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 | |
2bcfa9ee CW |
227 | /** |
228 | * Serialization method - a non-null value indicates a multi-valued field. | |
229 | * | |
230 | * @var int | |
231 | */ | |
232 | public $serialize; | |
233 | ||
e501603b TO |
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; | |
c3fc2621 | 240 | |
e501603b TO |
241 | /** |
242 | * Should the multi-record custom field values be displayed in tab table listing | |
243 | * | |
e6ca0a57 | 244 | * @var bool |
e501603b TO |
245 | */ |
246 | public $in_selector; | |
c3fc2621 | 247 | |
e501603b | 248 | /** |
f41f0342 | 249 | * Class constructor. |
e501603b | 250 | */ |
c3fc2621 | 251 | public function __construct() { |
e501603b TO |
252 | $this->__table = 'civicrm_custom_field'; |
253 | parent::__construct(); | |
254 | } | |
c3fc2621 | 255 | |
449c4e6b CW |
256 | /** |
257 | * Returns localized title of this entity. | |
258 | */ | |
259 | public static function getEntityTitle() { | |
260 | return ts('Custom Fields'); | |
261 | } | |
262 | ||
e501603b | 263 | /** |
f41f0342 | 264 | * Returns foreign keys and entity references. |
e501603b TO |
265 | * |
266 | * @return array | |
267 | * [CRM_Core_Reference_Interface] | |
268 | */ | |
c3fc2621 | 269 | public static function getReferenceColumns() { |
346aaaba | 270 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 271 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 272 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'custom_group_id', 'civicrm_custom_group', 'id'); |
2b216479 | 273 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'option_group_id', 'civicrm_option_group', 'id'); |
346aaaba | 274 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 275 | } |
346aaaba | 276 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 277 | } |
c3fc2621 | 278 | |
e501603b TO |
279 | /** |
280 | * Returns all the column names of this table | |
281 | * | |
282 | * @return array | |
283 | */ | |
c3fc2621 | 284 | public static function &fields() { |
346aaaba | 285 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
286 | Civi::$statics[__CLASS__]['fields'] = [ |
287 | 'id' => [ | |
e501603b TO |
288 | 'name' => 'id', |
289 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 290 | 'title' => ts('Custom Field ID'), |
215b423e | 291 | 'description' => ts('Unique Custom Field ID'), |
c3fc2621 | 292 | 'required' => TRUE, |
a36434b9 | 293 | 'where' => 'civicrm_custom_field.id', |
522a26c9 | 294 | 'table_name' => 'civicrm_custom_field', |
295 | 'entity' => 'CustomField', | |
296 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 297 | 'localizable' => 0, |
a9d0587b | 298 | 'add' => '1.1', |
c3fc2621 CW |
299 | ], |
300 | 'custom_group_id' => [ | |
e501603b TO |
301 | 'name' => 'custom_group_id', |
302 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 303 | 'title' => ts('Custom Group'), |
215b423e | 304 | 'description' => ts('FK to civicrm_custom_group.'), |
c3fc2621 | 305 | 'required' => TRUE, |
a36434b9 | 306 | 'where' => 'civicrm_custom_field.custom_group_id', |
522a26c9 | 307 | 'table_name' => 'civicrm_custom_field', |
308 | 'entity' => 'CustomField', | |
309 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 310 | 'localizable' => 0, |
e501603b | 311 | 'FKClassName' => 'CRM_Core_DAO_CustomGroup', |
c3fc2621 | 312 | 'html' => [ |
e501603b | 313 | 'type' => 'Select', |
c3fc2621 CW |
314 | ], |
315 | 'pseudoconstant' => [ | |
e501603b TO |
316 | 'table' => 'civicrm_custom_group', |
317 | 'keyColumn' => 'id', | |
318 | 'labelColumn' => 'title', | |
e6ca0a57 | 319 | ], |
a9d0587b | 320 | 'add' => '1.1', |
c3fc2621 CW |
321 | ], |
322 | 'name' => [ | |
e501603b TO |
323 | 'name' => 'name', |
324 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 325 | 'title' => ts('Custom Field Name'), |
215b423e | 326 | 'description' => ts('Variable name/programmatic handle for this group.'), |
e501603b TO |
327 | 'maxlength' => 64, |
328 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 329 | 'where' => 'civicrm_custom_field.name', |
522a26c9 | 330 | 'table_name' => 'civicrm_custom_field', |
331 | 'entity' => 'CustomField', | |
332 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 333 | 'localizable' => 0, |
a9d0587b | 334 | 'add' => '3.3', |
c3fc2621 CW |
335 | ], |
336 | 'label' => [ | |
e501603b TO |
337 | 'name' => 'label', |
338 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 339 | 'title' => ts('Custom Field Label'), |
215b423e | 340 | 'description' => ts('Text for form field label (also friendly name for administering this custom property).'), |
c3fc2621 | 341 | 'required' => TRUE, |
e501603b TO |
342 | 'maxlength' => 255, |
343 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 344 | 'where' => 'civicrm_custom_field.label', |
522a26c9 | 345 | 'table_name' => 'civicrm_custom_field', |
346 | 'entity' => 'CustomField', | |
347 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 348 | 'localizable' => 1, |
a9d0587b | 349 | 'add' => '1.1', |
c3fc2621 CW |
350 | ], |
351 | 'data_type' => [ | |
e501603b TO |
352 | 'name' => 'data_type', |
353 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 354 | 'title' => ts('Custom Field Data Type'), |
215b423e | 355 | 'description' => ts('Controls location of data storage in extended_data table.'), |
c3fc2621 | 356 | 'required' => TRUE, |
e501603b TO |
357 | 'maxlength' => 16, |
358 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 359 | 'where' => 'civicrm_custom_field.data_type', |
522a26c9 | 360 | 'table_name' => 'civicrm_custom_field', |
361 | 'entity' => 'CustomField', | |
362 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 363 | 'localizable' => 0, |
c3fc2621 | 364 | 'html' => [ |
e501603b | 365 | 'type' => 'Select', |
c3fc2621 CW |
366 | ], |
367 | 'pseudoconstant' => [ | |
e501603b | 368 | 'callback' => 'CRM_Core_BAO_CustomField::dataType', |
e6ca0a57 | 369 | ], |
a9d0587b | 370 | 'add' => '1.1', |
c3fc2621 CW |
371 | ], |
372 | 'html_type' => [ | |
e501603b TO |
373 | 'name' => 'html_type', |
374 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 375 | 'title' => ts('Custom Field HTML Type'), |
215b423e | 376 | 'description' => ts('HTML types plus several built-in extended types.'), |
c3fc2621 | 377 | 'required' => TRUE, |
e501603b TO |
378 | 'maxlength' => 32, |
379 | 'size' => CRM_Utils_Type::MEDIUM, | |
a36434b9 | 380 | 'where' => 'civicrm_custom_field.html_type', |
522a26c9 | 381 | 'table_name' => 'civicrm_custom_field', |
382 | 'entity' => 'CustomField', | |
383 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 384 | 'localizable' => 0, |
c3fc2621 | 385 | 'pseudoconstant' => [ |
e501603b | 386 | 'callback' => 'CRM_Core_SelectValues::customHtmlType', |
e6ca0a57 | 387 | ], |
a9d0587b | 388 | 'add' => '1.1', |
c3fc2621 CW |
389 | ], |
390 | 'default_value' => [ | |
e501603b TO |
391 | 'name' => 'default_value', |
392 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 393 | 'title' => ts('Custom Field Default'), |
215b423e | 394 | 'description' => ts('Use form_options.is_default for field_types which use options.'), |
e501603b TO |
395 | 'maxlength' => 255, |
396 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 397 | 'where' => 'civicrm_custom_field.default_value', |
522a26c9 | 398 | 'table_name' => 'civicrm_custom_field', |
399 | 'entity' => 'CustomField', | |
400 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 401 | 'localizable' => 0, |
a9d0587b | 402 | 'add' => '1.1', |
c3fc2621 CW |
403 | ], |
404 | 'is_required' => [ | |
e501603b TO |
405 | 'name' => 'is_required', |
406 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 407 | 'title' => ts('Custom Field Is Required?'), |
215b423e | 408 | 'description' => ts('Is a value required for this property.'), |
a36434b9 | 409 | 'where' => 'civicrm_custom_field.is_required', |
45a83e42 | 410 | 'default' => '0', |
522a26c9 | 411 | 'table_name' => 'civicrm_custom_field', |
412 | 'entity' => 'CustomField', | |
413 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 414 | 'localizable' => 0, |
a9d0587b | 415 | 'add' => '1.1', |
c3fc2621 CW |
416 | ], |
417 | 'is_searchable' => [ | |
e501603b TO |
418 | 'name' => 'is_searchable', |
419 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 420 | 'title' => ts('Allow Searching on Field?'), |
215b423e | 421 | 'description' => ts('Is this property searchable.'), |
a36434b9 | 422 | 'where' => 'civicrm_custom_field.is_searchable', |
45a83e42 | 423 | 'default' => '0', |
522a26c9 | 424 | 'table_name' => 'civicrm_custom_field', |
425 | 'entity' => 'CustomField', | |
426 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 427 | 'localizable' => 0, |
a9d0587b | 428 | 'add' => '1.1', |
c3fc2621 CW |
429 | ], |
430 | 'is_search_range' => [ | |
e501603b TO |
431 | 'name' => 'is_search_range', |
432 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 433 | 'title' => ts('Search as a Range'), |
215b423e | 434 | 'description' => ts('Is this property range searchable.'), |
a36434b9 | 435 | 'where' => 'civicrm_custom_field.is_search_range', |
45a83e42 | 436 | 'default' => '0', |
522a26c9 | 437 | 'table_name' => 'civicrm_custom_field', |
438 | 'entity' => 'CustomField', | |
439 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 440 | 'localizable' => 0, |
a9d0587b | 441 | 'add' => '1.4', |
c3fc2621 CW |
442 | ], |
443 | 'weight' => [ | |
e501603b TO |
444 | 'name' => 'weight', |
445 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 446 | 'title' => ts('Order'), |
215b423e | 447 | 'description' => ts('Controls field display order within an extended property group.'), |
c3fc2621 | 448 | 'required' => TRUE, |
a36434b9 | 449 | 'where' => 'civicrm_custom_field.weight', |
e501603b | 450 | 'default' => '1', |
522a26c9 | 451 | 'table_name' => 'civicrm_custom_field', |
452 | 'entity' => 'CustomField', | |
453 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 454 | 'localizable' => 0, |
a9d0587b | 455 | 'add' => '1.1', |
c3fc2621 CW |
456 | ], |
457 | 'help_pre' => [ | |
e501603b TO |
458 | 'name' => 'help_pre', |
459 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 460 | 'title' => ts('Custom Field Pre Text'), |
215b423e | 461 | 'description' => ts('Description and/or help text to display before this field.'), |
a36434b9 | 462 | 'where' => 'civicrm_custom_field.help_pre', |
522a26c9 | 463 | 'table_name' => 'civicrm_custom_field', |
464 | 'entity' => 'CustomField', | |
465 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 466 | 'localizable' => 1, |
a9d0587b | 467 | 'add' => '1.1', |
c3fc2621 CW |
468 | ], |
469 | 'help_post' => [ | |
e501603b TO |
470 | 'name' => 'help_post', |
471 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 472 | 'title' => ts('Custom Field Post Text'), |
215b423e | 473 | 'description' => ts('Description and/or help text to display after this field.'), |
a36434b9 | 474 | 'where' => 'civicrm_custom_field.help_post', |
522a26c9 | 475 | 'table_name' => 'civicrm_custom_field', |
476 | 'entity' => 'CustomField', | |
477 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 478 | 'localizable' => 1, |
a9d0587b | 479 | 'add' => '1.1', |
c3fc2621 CW |
480 | ], |
481 | 'mask' => [ | |
e501603b TO |
482 | 'name' => 'mask', |
483 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 484 | 'title' => ts('Custom Field Formatting'), |
215b423e | 485 | 'description' => ts('Optional format instructions for specific field types, like date types.'), |
e501603b TO |
486 | 'maxlength' => 64, |
487 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 488 | 'where' => 'civicrm_custom_field.mask', |
522a26c9 | 489 | 'table_name' => 'civicrm_custom_field', |
490 | 'entity' => 'CustomField', | |
491 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 492 | 'localizable' => 0, |
a9d0587b | 493 | 'add' => '1.1', |
c3fc2621 CW |
494 | ], |
495 | 'attributes' => [ | |
e501603b TO |
496 | 'name' => 'attributes', |
497 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 498 | 'title' => ts('Custom Field Attributes'), |
215b423e | 499 | 'description' => ts('Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes'), |
e501603b TO |
500 | 'maxlength' => 255, |
501 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 502 | 'where' => 'civicrm_custom_field.attributes', |
522a26c9 | 503 | 'table_name' => 'civicrm_custom_field', |
504 | 'entity' => 'CustomField', | |
505 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 506 | 'localizable' => 0, |
a9d0587b | 507 | 'add' => '1.1', |
c3fc2621 CW |
508 | ], |
509 | 'javascript' => [ | |
e501603b TO |
510 | 'name' => 'javascript', |
511 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 512 | 'title' => ts('Custom Field Javascript'), |
215b423e | 513 | 'description' => ts('Optional scripting attributes for field.'), |
e501603b TO |
514 | 'maxlength' => 255, |
515 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 516 | 'where' => 'civicrm_custom_field.javascript', |
522a26c9 | 517 | 'table_name' => 'civicrm_custom_field', |
518 | 'entity' => 'CustomField', | |
519 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 520 | 'localizable' => 0, |
a9d0587b | 521 | 'add' => '1.1', |
c3fc2621 CW |
522 | ], |
523 | 'is_active' => [ | |
e501603b TO |
524 | 'name' => 'is_active', |
525 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 526 | 'title' => ts('Custom Field Is Active?'), |
215b423e | 527 | 'description' => ts('Is this property active?'), |
a36434b9 | 528 | 'where' => 'civicrm_custom_field.is_active', |
110f4343 | 529 | 'default' => '1', |
522a26c9 | 530 | 'table_name' => 'civicrm_custom_field', |
531 | 'entity' => 'CustomField', | |
532 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 533 | 'localizable' => 0, |
a9d0587b | 534 | 'add' => '1.1', |
c3fc2621 CW |
535 | ], |
536 | 'is_view' => [ | |
e501603b TO |
537 | 'name' => 'is_view', |
538 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 539 | 'title' => ts('Field is Viewable'), |
215b423e | 540 | 'description' => ts('Is this property set by PHP Code? A code field is viewable but not editable'), |
a36434b9 | 541 | 'where' => 'civicrm_custom_field.is_view', |
45a83e42 | 542 | 'default' => '0', |
522a26c9 | 543 | 'table_name' => 'civicrm_custom_field', |
544 | 'entity' => 'CustomField', | |
545 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 546 | 'localizable' => 0, |
a9d0587b | 547 | 'add' => '1.1', |
c3fc2621 CW |
548 | ], |
549 | 'options_per_line' => [ | |
e501603b TO |
550 | 'name' => 'options_per_line', |
551 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 552 | 'title' => ts('Field Options Per Line'), |
215b423e | 553 | 'description' => ts('number of options per line for checkbox and radio'), |
a36434b9 | 554 | 'where' => 'civicrm_custom_field.options_per_line', |
522a26c9 | 555 | 'table_name' => 'civicrm_custom_field', |
556 | 'entity' => 'CustomField', | |
557 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 558 | 'localizable' => 0, |
a9d0587b | 559 | 'add' => NULL, |
c3fc2621 CW |
560 | ], |
561 | 'text_length' => [ | |
e501603b TO |
562 | 'name' => 'text_length', |
563 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 564 | 'title' => ts('Field Length'), |
215b423e | 565 | 'description' => ts('field length if alphanumeric'), |
a36434b9 | 566 | 'where' => 'civicrm_custom_field.text_length', |
522a26c9 | 567 | 'table_name' => 'civicrm_custom_field', |
568 | 'entity' => 'CustomField', | |
569 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 570 | 'localizable' => 0, |
a9d0587b | 571 | 'add' => '2.2', |
c3fc2621 CW |
572 | ], |
573 | 'start_date_years' => [ | |
e501603b TO |
574 | 'name' => 'start_date_years', |
575 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 576 | 'title' => ts('Field Start Date'), |
215b423e | 577 | 'description' => ts('Date may be up to start_date_years years prior to the current date.'), |
a36434b9 | 578 | 'where' => 'civicrm_custom_field.start_date_years', |
522a26c9 | 579 | 'table_name' => 'civicrm_custom_field', |
580 | 'entity' => 'CustomField', | |
581 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 582 | 'localizable' => 0, |
a9d0587b | 583 | 'add' => '1.4', |
c3fc2621 CW |
584 | ], |
585 | 'end_date_years' => [ | |
e501603b TO |
586 | 'name' => 'end_date_years', |
587 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 588 | 'title' => ts('Field End Date'), |
215b423e | 589 | 'description' => ts('Date may be up to end_date_years years after the current date.'), |
a36434b9 | 590 | 'where' => 'civicrm_custom_field.end_date_years', |
522a26c9 | 591 | 'table_name' => 'civicrm_custom_field', |
592 | 'entity' => 'CustomField', | |
593 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 594 | 'localizable' => 0, |
a9d0587b | 595 | 'add' => '1.4', |
c3fc2621 CW |
596 | ], |
597 | 'date_format' => [ | |
e501603b TO |
598 | 'name' => 'date_format', |
599 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 600 | 'title' => ts('Field Data Format'), |
215b423e | 601 | 'description' => ts('date format for custom date'), |
e501603b TO |
602 | 'maxlength' => 64, |
603 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 604 | 'where' => 'civicrm_custom_field.date_format', |
522a26c9 | 605 | 'table_name' => 'civicrm_custom_field', |
606 | 'entity' => 'CustomField', | |
607 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 608 | 'localizable' => 0, |
72c65bfa CW |
609 | 'pseudoconstant' => [ |
610 | 'callback' => 'CRM_Core_SelectValues::getDatePluginInputFormats', | |
611 | ], | |
a9d0587b | 612 | 'add' => '3.1', |
c3fc2621 CW |
613 | ], |
614 | 'time_format' => [ | |
e501603b TO |
615 | 'name' => 'time_format', |
616 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 617 | 'title' => ts('Field Time Format'), |
215b423e | 618 | 'description' => ts('time format for custom date'), |
a36434b9 | 619 | 'where' => 'civicrm_custom_field.time_format', |
522a26c9 | 620 | 'table_name' => 'civicrm_custom_field', |
621 | 'entity' => 'CustomField', | |
622 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 623 | 'localizable' => 0, |
72c65bfa CW |
624 | 'pseudoconstant' => [ |
625 | 'callback' => 'CRM_Core_SelectValues::getTimeFormats', | |
626 | ], | |
a9d0587b | 627 | 'add' => '3.1', |
c3fc2621 CW |
628 | ], |
629 | 'note_columns' => [ | |
e501603b TO |
630 | 'name' => 'note_columns', |
631 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 632 | 'title' => ts('Field Note Columns'), |
1836ab9e | 633 | 'description' => ts('Number of columns in Note Field'), |
a36434b9 | 634 | 'where' => 'civicrm_custom_field.note_columns', |
522a26c9 | 635 | 'table_name' => 'civicrm_custom_field', |
636 | 'entity' => 'CustomField', | |
637 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 638 | 'localizable' => 0, |
a9d0587b | 639 | 'add' => '1.4', |
c3fc2621 CW |
640 | ], |
641 | 'note_rows' => [ | |
e501603b TO |
642 | 'name' => 'note_rows', |
643 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 644 | 'title' => ts('Field Note Rows'), |
1836ab9e | 645 | 'description' => ts('Number of rows in Note Field'), |
a36434b9 | 646 | 'where' => 'civicrm_custom_field.note_rows', |
522a26c9 | 647 | 'table_name' => 'civicrm_custom_field', |
648 | 'entity' => 'CustomField', | |
649 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 650 | 'localizable' => 0, |
a9d0587b | 651 | 'add' => '1.4', |
c3fc2621 CW |
652 | ], |
653 | 'column_name' => [ | |
e501603b TO |
654 | 'name' => 'column_name', |
655 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 656 | 'title' => ts('Field Column Name'), |
215b423e | 657 | 'description' => ts('Name of the column that holds the values for this field.'), |
e501603b TO |
658 | 'maxlength' => 255, |
659 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 660 | 'where' => 'civicrm_custom_field.column_name', |
522a26c9 | 661 | 'table_name' => 'civicrm_custom_field', |
662 | 'entity' => 'CustomField', | |
663 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 664 | 'localizable' => 0, |
a9d0587b | 665 | 'add' => '2.0', |
c3fc2621 CW |
666 | ], |
667 | 'option_group_id' => [ | |
e501603b TO |
668 | 'name' => 'option_group_id', |
669 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 670 | 'title' => ts('Field Option Group'), |
215b423e | 671 | 'description' => ts('For elements with options, the option group id that is used'), |
a36434b9 | 672 | 'where' => 'civicrm_custom_field.option_group_id', |
522a26c9 | 673 | 'table_name' => 'civicrm_custom_field', |
674 | 'entity' => 'CustomField', | |
675 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 676 | 'localizable' => 0, |
2b216479 | 677 | 'FKClassName' => 'CRM_Core_DAO_OptionGroup', |
5830940d MM |
678 | 'pseudoconstant' => [ |
679 | 'table' => 'civicrm_option_group', | |
680 | 'keyColumn' => 'id', | |
681 | 'labelColumn' => 'title', | |
e6ca0a57 | 682 | ], |
a9d0587b | 683 | 'add' => '1.4', |
c3fc2621 | 684 | ], |
2bcfa9ee CW |
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 | ], | |
a9d0587b | 698 | 'add' => '5.26', |
2bcfa9ee | 699 | ], |
c3fc2621 | 700 | 'filter' => [ |
e501603b TO |
701 | 'name' => 'filter', |
702 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 703 | 'title' => ts('Field Filter'), |
215b423e | 704 | 'description' => ts('Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.'), |
e501603b TO |
705 | 'maxlength' => 255, |
706 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 707 | 'where' => 'civicrm_custom_field.filter', |
522a26c9 | 708 | 'table_name' => 'civicrm_custom_field', |
709 | 'entity' => 'CustomField', | |
710 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 711 | 'localizable' => 0, |
a9d0587b | 712 | 'add' => '4.1', |
c3fc2621 CW |
713 | ], |
714 | 'in_selector' => [ | |
e501603b TO |
715 | 'name' => 'in_selector', |
716 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 717 | 'title' => ts('Field Display'), |
215b423e | 718 | 'description' => ts('Should the multi-record custom field values be displayed in tab table listing'), |
a36434b9 | 719 | 'where' => 'civicrm_custom_field.in_selector', |
45a83e42 | 720 | 'default' => '0', |
522a26c9 | 721 | 'table_name' => 'civicrm_custom_field', |
722 | 'entity' => 'CustomField', | |
723 | 'bao' => 'CRM_Core_BAO_CustomField', | |
6a7e5e5d | 724 | 'localizable' => 0, |
a9d0587b | 725 | 'add' => '4.5', |
c3fc2621 CW |
726 | ], |
727 | ]; | |
346aaaba | 728 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 729 | } |
346aaaba | 730 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 731 | } |
c3fc2621 | 732 | |
e501603b | 733 | /** |
bd8e0b14 | 734 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
735 | * |
736 | * @return array | |
bd8e0b14 | 737 | * Array(string $name => string $uniqueName). |
e501603b | 738 | */ |
c3fc2621 | 739 | public static function &fieldKeys() { |
bd8e0b14 TO |
740 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
741 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 742 | } |
bd8e0b14 | 743 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 744 | } |
c3fc2621 | 745 | |
e501603b TO |
746 | /** |
747 | * Returns the names of this table | |
748 | * | |
749 | * @return string | |
750 | */ | |
c3fc2621 | 751 | public static function getTableName() { |
e501603b TO |
752 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
753 | } | |
c3fc2621 | 754 | |
e501603b TO |
755 | /** |
756 | * Returns if this table needs to be logged | |
757 | * | |
c3fc2621 | 758 | * @return bool |
e501603b | 759 | */ |
c3fc2621 | 760 | public function getLog() { |
e501603b TO |
761 | return self::$_log; |
762 | } | |
c3fc2621 | 763 | |
e501603b TO |
764 | /** |
765 | * Returns the list of fields that can be imported | |
766 | * | |
767 | * @param bool $prefix | |
768 | * | |
769 | * @return array | |
770 | */ | |
c3fc2621 CW |
771 | public static function &import($prefix = FALSE) { |
772 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_field', $prefix, []); | |
60808919 | 773 | return $r; |
e501603b | 774 | } |
c3fc2621 | 775 | |
e501603b TO |
776 | /** |
777 | * Returns the list of fields that can be exported | |
778 | * | |
779 | * @param bool $prefix | |
780 | * | |
781 | * @return array | |
782 | */ | |
c3fc2621 CW |
783 | public static function &export($prefix = FALSE) { |
784 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_field', $prefix, []); | |
60808919 | 785 | return $r; |
e501603b | 786 | } |
c3fc2621 | 787 | |
e7a6b91a AS |
788 | /** |
789 | * Returns the list of indices | |
c3fc2621 CW |
790 | * |
791 | * @param bool $localize | |
792 | * | |
793 | * @return array | |
e7a6b91a AS |
794 | */ |
795 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
796 | $indices = [ |
797 | 'UI_label_custom_group_id' => [ | |
e7a6b91a | 798 | 'name' => 'UI_label_custom_group_id', |
c3fc2621 | 799 | 'field' => [ |
e7a6b91a AS |
800 | 0 => 'label', |
801 | 1 => 'custom_group_id', | |
c3fc2621 CW |
802 | ], |
803 | 'localizable' => TRUE, | |
804 | 'unique' => TRUE, | |
e7a6b91a | 805 | 'sig' => 'civicrm_custom_field::1::label::custom_group_id', |
c3fc2621 CW |
806 | ], |
807 | 'UI_name_custom_group_id' => [ | |
e7a6b91a | 808 | 'name' => 'UI_name_custom_group_id', |
c3fc2621 | 809 | 'field' => [ |
e7a6b91a AS |
810 | 0 => 'name', |
811 | 1 => 'custom_group_id', | |
c3fc2621 CW |
812 | ], |
813 | 'localizable' => FALSE, | |
814 | 'unique' => TRUE, | |
e7a6b91a | 815 | 'sig' => 'civicrm_custom_field::1::name::custom_group_id', |
c3fc2621 CW |
816 | ], |
817 | ]; | |
e7a6b91a AS |
818 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
819 | } | |
c3fc2621 | 820 | |
e501603b | 821 | } |