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