Add titles and icons to entities
[civicrm-core.git] / CRM / Core / DAO / UFField.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/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
449c4e6b 9 * (GenCodeChecksum:00cecb109e6a5589dff3c84d3665abfd)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the UFField entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_UFField 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_uf_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 table ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Which form does this field belong to.
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $uf_group_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Name for CiviCRM field which is being exposed for sharing.
47 *
48 * @var string
49 */
50 public $field_name;
c3fc2621 51
e501603b
TO
52 /**
53 * Is this field currently shareable? If false, hide the field for all sharing contexts.
54 *
e6ca0a57 55 * @var bool
e501603b
TO
56 */
57 public $is_active;
c3fc2621 58
e501603b
TO
59 /**
60 * the field is view only and not editable in user forms.
61 *
e6ca0a57 62 * @var bool
e501603b
TO
63 */
64 public $is_view;
c3fc2621 65
e501603b
TO
66 /**
67 * Is this field required when included in a user or registration form?
68 *
e6ca0a57 69 * @var bool
e501603b
TO
70 */
71 public $is_required;
c3fc2621 72
e501603b
TO
73 /**
74 * Controls field display order when user framework fields are displayed in registration and account editing forms.
75 *
76 * @var int
77 */
78 public $weight;
c3fc2621 79
e501603b
TO
80 /**
81 * Description and/or help text to display after this field.
82 *
83 * @var text
84 */
85 public $help_post;
c3fc2621 86
e501603b
TO
87 /**
88 * Description and/or help text to display before this field.
89 *
90 * @var text
91 */
92 public $help_pre;
c3fc2621 93
e501603b
TO
94 /**
95 * In what context(s) is this field visible.
96 *
97 * @var string
98 */
99 public $visibility;
c3fc2621 100
e501603b
TO
101 /**
102 * Is this field included as a column in the selector table?
103 *
e6ca0a57 104 * @var bool
e501603b
TO
105 */
106 public $in_selector;
c3fc2621 107
e501603b
TO
108 /**
109 * Is this field included search form of profile?
110 *
e6ca0a57 111 * @var bool
e501603b
TO
112 */
113 public $is_searchable;
c3fc2621 114
e501603b
TO
115 /**
116 * Location type of this mapping, if required
117 *
e6ca0a57 118 * @var int
e501603b
TO
119 */
120 public $location_type_id;
c3fc2621 121
e501603b
TO
122 /**
123 * Phone Type Id, if required
124 *
e6ca0a57 125 * @var int
e501603b
TO
126 */
127 public $phone_type_id;
c3fc2621 128
e501603b
TO
129 /**
130 * Website Type Id, if required
131 *
e6ca0a57 132 * @var int
e501603b
TO
133 */
134 public $website_type_id;
c3fc2621 135
e501603b
TO
136 /**
137 * To save label for fields.
138 *
139 * @var string
140 */
141 public $label;
c3fc2621 142
e501603b
TO
143 /**
144 * This field saves field type (ie individual,household.. field etc).
145 *
146 * @var string
147 */
148 public $field_type;
c3fc2621 149
e501603b
TO
150 /**
151 * Is this field reserved for use by some other CiviCRM functionality?
152 *
e6ca0a57 153 * @var bool
e501603b
TO
154 */
155 public $is_reserved;
c3fc2621 156
e501603b
TO
157 /**
158 * Include in multi-record listing?
159 *
e6ca0a57 160 * @var bool
e501603b
TO
161 */
162 public $is_multi_summary;
c3fc2621 163
e501603b 164 /**
f41f0342 165 * Class constructor.
e501603b 166 */
c3fc2621 167 public function __construct() {
e501603b
TO
168 $this->__table = 'civicrm_uf_field';
169 parent::__construct();
170 }
c3fc2621 171
449c4e6b
CW
172 /**
173 * Returns localized title of this entity.
174 */
175 public static function getEntityTitle() {
176 return ts('UFFields');
177 }
178
e501603b 179 /**
f41f0342 180 * Returns foreign keys and entity references.
e501603b
TO
181 *
182 * @return array
183 * [CRM_Core_Reference_Interface]
184 */
c3fc2621 185 public static function getReferenceColumns() {
346aaaba 186 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 187 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
188 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id');
189 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
346aaaba 190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 191 }
346aaaba 192 return Civi::$statics[__CLASS__]['links'];
e501603b 193 }
c3fc2621 194
e501603b
TO
195 /**
196 * Returns all the column names of this table
197 *
198 * @return array
199 */
c3fc2621 200 public static function &fields() {
346aaaba 201 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
202 Civi::$statics[__CLASS__]['fields'] = [
203 'id' => [
e501603b
TO
204 'name' => 'id',
205 'type' => CRM_Utils_Type::T_INT,
c3fc2621 206 'title' => ts('Profile Field ID'),
215b423e 207 'description' => ts('Unique table ID'),
c3fc2621 208 'required' => TRUE,
a36434b9 209 'where' => 'civicrm_uf_field.id',
522a26c9 210 'table_name' => 'civicrm_uf_field',
211 'entity' => 'UFField',
212 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 213 'localizable' => 0,
c3fc2621
CW
214 ],
215 'uf_group_id' => [
e501603b
TO
216 'name' => 'uf_group_id',
217 'type' => CRM_Utils_Type::T_INT,
c3fc2621 218 'title' => ts('Profile ID'),
215b423e 219 'description' => ts('Which form does this field belong to.'),
c3fc2621 220 'required' => TRUE,
a36434b9 221 'where' => 'civicrm_uf_field.uf_group_id',
522a26c9 222 'table_name' => 'civicrm_uf_field',
223 'entity' => 'UFField',
224 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 225 'localizable' => 0,
e501603b 226 'FKClassName' => 'CRM_Core_DAO_UFGroup',
c3fc2621 227 'html' => [
e501603b 228 'type' => 'Select',
c3fc2621
CW
229 ],
230 'pseudoconstant' => [
e501603b
TO
231 'table' => 'civicrm_uf_group',
232 'keyColumn' => 'id',
233 'labelColumn' => 'title',
e6ca0a57 234 ],
c3fc2621
CW
235 ],
236 'field_name' => [
e501603b
TO
237 'name' => 'field_name',
238 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 239 'title' => ts('Profile Field Name'),
215b423e 240 'description' => ts('Name for CiviCRM field which is being exposed for sharing.'),
c3fc2621 241 'required' => TRUE,
e501603b
TO
242 'maxlength' => 64,
243 'size' => CRM_Utils_Type::BIG,
a36434b9 244 'where' => 'civicrm_uf_field.field_name',
522a26c9 245 'table_name' => 'civicrm_uf_field',
246 'entity' => 'UFField',
247 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 248 'localizable' => 0,
ffb9cdec
CW
249 'pseudoconstant' => [
250 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
e6ca0a57 251 ],
c3fc2621
CW
252 ],
253 'is_active' => [
e501603b
TO
254 'name' => 'is_active',
255 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 256 'title' => ts('Profile Field Is Active'),
215b423e 257 'description' => ts('Is this field currently shareable? If false, hide the field for all sharing contexts.'),
a36434b9 258 'where' => 'civicrm_uf_field.is_active',
e501603b 259 'default' => '1',
522a26c9 260 'table_name' => 'civicrm_uf_field',
261 'entity' => 'UFField',
262 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 263 'localizable' => 0,
c3fc2621
CW
264 ],
265 'is_view' => [
e501603b
TO
266 'name' => 'is_view',
267 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 268 'title' => ts('Profile Is View Only'),
215b423e 269 'description' => ts('the field is view only and not editable in user forms.'),
a36434b9 270 'where' => 'civicrm_uf_field.is_view',
45a83e42 271 'default' => '0',
522a26c9 272 'table_name' => 'civicrm_uf_field',
273 'entity' => 'UFField',
274 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 275 'localizable' => 0,
c3fc2621
CW
276 ],
277 'is_required' => [
e501603b
TO
278 'name' => 'is_required',
279 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 280 'title' => ts('Profile Field Is Required'),
215b423e 281 'description' => ts('Is this field required when included in a user or registration form?'),
a36434b9 282 'where' => 'civicrm_uf_field.is_required',
45a83e42 283 'default' => '0',
522a26c9 284 'table_name' => 'civicrm_uf_field',
285 'entity' => 'UFField',
286 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 287 'localizable' => 0,
c3fc2621
CW
288 ],
289 'weight' => [
e501603b
TO
290 'name' => 'weight',
291 'type' => CRM_Utils_Type::T_INT,
c3fc2621 292 'title' => ts('Order'),
215b423e 293 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
c3fc2621 294 'required' => TRUE,
a36434b9 295 'where' => 'civicrm_uf_field.weight',
e501603b 296 'default' => '1',
522a26c9 297 'table_name' => 'civicrm_uf_field',
298 'entity' => 'UFField',
299 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 300 'localizable' => 0,
c3fc2621
CW
301 ],
302 'help_post' => [
e501603b
TO
303 'name' => 'help_post',
304 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 305 'title' => ts('Profile Field Post Help'),
215b423e 306 'description' => ts('Description and/or help text to display after this field.'),
a36434b9 307 'where' => 'civicrm_uf_field.help_post',
522a26c9 308 'table_name' => 'civicrm_uf_field',
309 'entity' => 'UFField',
310 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 311 'localizable' => 1,
c3fc2621
CW
312 ],
313 'help_pre' => [
e501603b
TO
314 'name' => 'help_pre',
315 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 316 'title' => ts('Profile Field Pre Help'),
215b423e 317 'description' => ts('Description and/or help text to display before this field.'),
a36434b9 318 'where' => 'civicrm_uf_field.help_pre',
522a26c9 319 'table_name' => 'civicrm_uf_field',
320 'entity' => 'UFField',
321 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 322 'localizable' => 1,
c3fc2621
CW
323 ],
324 'visibility' => [
e501603b
TO
325 'name' => 'visibility',
326 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 327 'title' => ts('Profile Field Visibility'),
215b423e 328 'description' => ts('In what context(s) is this field visible.'),
e501603b
TO
329 'maxlength' => 32,
330 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 331 'where' => 'civicrm_uf_field.visibility',
e501603b 332 'default' => 'User and User Admin Only',
522a26c9 333 'table_name' => 'civicrm_uf_field',
334 'entity' => 'UFField',
335 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 336 'localizable' => 0,
c3fc2621 337 'html' => [
e501603b 338 'type' => 'Select',
c3fc2621
CW
339 ],
340 'pseudoconstant' => [
e501603b 341 'callback' => 'CRM_Core_SelectValues::ufVisibility',
e6ca0a57 342 ],
c3fc2621
CW
343 ],
344 'in_selector' => [
e501603b
TO
345 'name' => 'in_selector',
346 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 347 'title' => ts('Profile Field Is a Filter'),
215b423e 348 'description' => ts('Is this field included as a column in the selector table?'),
a36434b9 349 'where' => 'civicrm_uf_field.in_selector',
45a83e42 350 'default' => '0',
522a26c9 351 'table_name' => 'civicrm_uf_field',
352 'entity' => 'UFField',
353 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 354 'localizable' => 0,
c3fc2621
CW
355 ],
356 'is_searchable' => [
e501603b
TO
357 'name' => 'is_searchable',
358 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 359 'title' => ts('Profile Field Is Searchable'),
215b423e 360 'description' => ts('Is this field included search form of profile?'),
a36434b9 361 'where' => 'civicrm_uf_field.is_searchable',
45a83e42 362 'default' => '0',
522a26c9 363 'table_name' => 'civicrm_uf_field',
364 'entity' => 'UFField',
365 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 366 'localizable' => 0,
c3fc2621
CW
367 ],
368 'location_type_id' => [
e501603b
TO
369 'name' => 'location_type_id',
370 'type' => CRM_Utils_Type::T_INT,
c3fc2621 371 'title' => ts('Profile Field Location Type'),
215b423e 372 'description' => ts('Location type of this mapping, if required'),
a36434b9 373 'where' => 'civicrm_uf_field.location_type_id',
522a26c9 374 'table_name' => 'civicrm_uf_field',
375 'entity' => 'UFField',
376 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 377 'localizable' => 0,
e501603b 378 'FKClassName' => 'CRM_Core_DAO_LocationType',
c3fc2621
CW
379 ],
380 'phone_type_id' => [
e501603b
TO
381 'name' => 'phone_type_id',
382 'type' => CRM_Utils_Type::T_INT,
c3fc2621 383 'title' => ts('Profile Field Phone Type'),
215b423e 384 'description' => ts('Phone Type Id, if required'),
a36434b9 385 'where' => 'civicrm_uf_field.phone_type_id',
522a26c9 386 'table_name' => 'civicrm_uf_field',
387 'entity' => 'UFField',
388 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 389 'localizable' => 0,
b9bf5852
PN
390 'pseudoconstant' => [
391 'optionGroupName' => 'phone_type',
392 'optionEditPath' => 'civicrm/admin/options/phone_type',
e6ca0a57 393 ],
c3fc2621
CW
394 ],
395 'website_type_id' => [
e501603b
TO
396 'name' => 'website_type_id',
397 'type' => CRM_Utils_Type::T_INT,
c3fc2621 398 'title' => ts('Profile Field Website Type'),
215b423e 399 'description' => ts('Website Type Id, if required'),
a36434b9 400 'where' => 'civicrm_uf_field.website_type_id',
522a26c9 401 'table_name' => 'civicrm_uf_field',
402 'entity' => 'UFField',
403 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 404 'localizable' => 0,
b9bf5852
PN
405 'pseudoconstant' => [
406 'optionGroupName' => 'website_type',
407 'optionEditPath' => 'civicrm/admin/options/website_type',
e6ca0a57 408 ],
c3fc2621
CW
409 ],
410 'label' => [
e501603b
TO
411 'name' => 'label',
412 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 413 'title' => ts('Profile Field Label'),
215b423e 414 'description' => ts('To save label for fields.'),
c3fc2621 415 'required' => TRUE,
e501603b
TO
416 'maxlength' => 255,
417 'size' => CRM_Utils_Type::HUGE,
a36434b9 418 'where' => 'civicrm_uf_field.label',
522a26c9 419 'table_name' => 'civicrm_uf_field',
420 'entity' => 'UFField',
421 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 422 'localizable' => 1,
c3fc2621
CW
423 ],
424 'field_type' => [
e501603b
TO
425 'name' => 'field_type',
426 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 427 'title' => ts('Profile Field Type'),
215b423e 428 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
e501603b
TO
429 'maxlength' => 255,
430 'size' => CRM_Utils_Type::HUGE,
a36434b9 431 'where' => 'civicrm_uf_field.field_type',
522a26c9 432 'table_name' => 'civicrm_uf_field',
433 'entity' => 'UFField',
434 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 435 'localizable' => 0,
c3fc2621
CW
436 ],
437 'is_reserved' => [
e501603b
TO
438 'name' => 'is_reserved',
439 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 440 'title' => ts('Profile Field Is Reserved'),
215b423e 441 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
a36434b9 442 'where' => 'civicrm_uf_field.is_reserved',
522a26c9 443 'table_name' => 'civicrm_uf_field',
444 'entity' => 'UFField',
445 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 446 'localizable' => 0,
c3fc2621
CW
447 ],
448 'is_multi_summary' => [
e501603b
TO
449 'name' => 'is_multi_summary',
450 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 451 'title' => ts('Profile Field Supports Multiple'),
215b423e 452 'description' => ts('Include in multi-record listing?'),
a36434b9 453 'where' => 'civicrm_uf_field.is_multi_summary',
45a83e42 454 'default' => '0',
522a26c9 455 'table_name' => 'civicrm_uf_field',
456 'entity' => 'UFField',
457 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 458 'localizable' => 0,
c3fc2621
CW
459 ],
460 ];
346aaaba 461 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 462 }
346aaaba 463 return Civi::$statics[__CLASS__]['fields'];
e501603b 464 }
c3fc2621 465
e501603b 466 /**
bd8e0b14 467 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
468 *
469 * @return array
bd8e0b14 470 * Array(string $name => string $uniqueName).
e501603b 471 */
c3fc2621 472 public static function &fieldKeys() {
bd8e0b14
TO
473 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
474 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 475 }
bd8e0b14 476 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 477 }
c3fc2621 478
e501603b
TO
479 /**
480 * Returns the names of this table
481 *
482 * @return string
483 */
c3fc2621 484 public static function getTableName() {
e501603b
TO
485 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
486 }
c3fc2621 487
e501603b
TO
488 /**
489 * Returns if this table needs to be logged
490 *
c3fc2621 491 * @return bool
e501603b 492 */
c3fc2621 493 public function getLog() {
e501603b
TO
494 return self::$_log;
495 }
c3fc2621 496
e501603b
TO
497 /**
498 * Returns the list of fields that can be imported
499 *
500 * @param bool $prefix
501 *
502 * @return array
503 */
c3fc2621
CW
504 public static function &import($prefix = FALSE) {
505 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []);
60808919 506 return $r;
e501603b 507 }
c3fc2621 508
e501603b
TO
509 /**
510 * Returns the list of fields that can be exported
511 *
512 * @param bool $prefix
513 *
514 * @return array
515 */
c3fc2621
CW
516 public static function &export($prefix = FALSE) {
517 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []);
60808919 518 return $r;
e501603b 519 }
c3fc2621 520
e7a6b91a
AS
521 /**
522 * Returns the list of indices
c3fc2621
CW
523 *
524 * @param bool $localize
525 *
526 * @return array
e7a6b91a
AS
527 */
528 public static function indices($localize = TRUE) {
c3fc2621
CW
529 $indices = [
530 'IX_website_type_id' => [
e7a6b91a 531 'name' => 'IX_website_type_id',
c3fc2621 532 'field' => [
e7a6b91a 533 0 => 'website_type_id',
c3fc2621
CW
534 ],
535 'localizable' => FALSE,
e7a6b91a 536 'sig' => 'civicrm_uf_field::0::website_type_id',
c3fc2621
CW
537 ],
538 ];
e7a6b91a
AS
539 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
540 }
c3fc2621 541
e501603b 542}