Merge pull request #22228 from colemanw/managedGroup
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.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/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
c9ac084f 9 * (GenCodeChecksum:27a1b80ba9d2696e97dd1df33468caff)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the CustomGroup entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_CustomGroup 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_custom_group';
c3fc2621 25
8ab43c93
CW
26 /**
27 * Field to show when displaying a record.
28 *
29 * @var string
30 */
31 public static $_labelField = 'title';
32
e501603b 33 /**
f41f0342 34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 35 *
c3fc2621 36 * @var bool
e501603b 37 */
fa45b5b9 38 public static $_log = TRUE;
c3fc2621 39
e501603b
TO
40 /**
41 * Unique Custom Group ID
42 *
e6ca0a57 43 * @var int
e501603b
TO
44 */
45 public $id;
c3fc2621 46
e501603b
TO
47 /**
48 * Variable name/programmatic handle for this group.
49 *
50 * @var string
51 */
52 public $name;
c3fc2621 53
e501603b
TO
54 /**
55 * Friendly Name.
56 *
57 * @var string
58 */
59 public $title;
c3fc2621 60
e501603b
TO
61 /**
62 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
63 *
64 * @var string
65 */
66 public $extends;
c3fc2621 67
e501603b
TO
68 /**
69 * FK to civicrm_option_value.id (for option group custom_data_type.)
70 *
e6ca0a57 71 * @var int
e501603b
TO
72 */
73 public $extends_entity_column_id;
c3fc2621 74
e501603b
TO
75 /**
76 * linking custom group for dynamic object
77 *
78 * @var string
79 */
80 public $extends_entity_column_value;
c3fc2621 81
e501603b
TO
82 /**
83 * Visual relationship between this form and its parent.
84 *
85 * @var string
86 */
87 public $style;
c3fc2621 88
e501603b
TO
89 /**
90 * Will this group be in collapsed or expanded mode on initial display ?
91 *
9752268e 92 * @var bool
e501603b
TO
93 */
94 public $collapse_display;
c3fc2621 95
e501603b
TO
96 /**
97 * Description and/or help text to display before fields in form.
98 *
99 * @var text
100 */
101 public $help_pre;
c3fc2621 102
e501603b
TO
103 /**
104 * Description and/or help text to display after fields in form.
105 *
106 * @var text
107 */
108 public $help_post;
c3fc2621 109
e501603b
TO
110 /**
111 * Controls display order when multiple extended property groups are setup for the same class.
112 *
113 * @var int
114 */
115 public $weight;
c3fc2621 116
e501603b
TO
117 /**
118 * Is this property active?
119 *
e6ca0a57 120 * @var bool
e501603b
TO
121 */
122 public $is_active;
c3fc2621 123
e501603b
TO
124 /**
125 * Name of the table that holds the values for this group.
126 *
127 * @var string
128 */
129 public $table_name;
c3fc2621 130
e501603b
TO
131 /**
132 * Does this group hold multiple values?
133 *
e6ca0a57 134 * @var bool
e501603b
TO
135 */
136 public $is_multiple;
c3fc2621 137
e501603b
TO
138 /**
139 * minimum number of multiple records (typically 0?)
140 *
e6ca0a57 141 * @var int
e501603b
TO
142 */
143 public $min_multiple;
c3fc2621 144
e501603b
TO
145 /**
146 * maximum number of multiple records, if 0 - no max
147 *
e6ca0a57 148 * @var int
e501603b
TO
149 */
150 public $max_multiple;
c3fc2621 151
e501603b
TO
152 /**
153 * Will this group be in collapsed or expanded mode on advanced search display ?
154 *
9752268e 155 * @var bool
e501603b
TO
156 */
157 public $collapse_adv_display;
c3fc2621 158
e501603b
TO
159 /**
160 * FK to civicrm_contact, who created this custom group
161 *
e6ca0a57 162 * @var int
e501603b
TO
163 */
164 public $created_id;
c3fc2621 165
e501603b
TO
166 /**
167 * Date and time this custom group was created.
168 *
169 * @var datetime
170 */
171 public $created_date;
c3fc2621 172
e501603b
TO
173 /**
174 * Is this a reserved Custom Group?
175 *
e6ca0a57 176 * @var bool
e501603b
TO
177 */
178 public $is_reserved;
c3fc2621 179
460931ca
JP
180 /**
181 * Is this property public?
182 *
e6ca0a57 183 * @var bool
460931ca
JP
184 */
185 public $is_public;
c3fc2621 186
2af06525
CW
187 /**
188 * crm-i icon class
189 *
190 * @var string
191 */
192 public $icon;
193
e501603b 194 /**
f41f0342 195 * Class constructor.
e501603b 196 */
c3fc2621 197 public function __construct() {
e501603b
TO
198 $this->__table = 'civicrm_custom_group';
199 parent::__construct();
200 }
c3fc2621 201
449c4e6b
CW
202 /**
203 * Returns localized title of this entity.
7b66c3b5
AH
204 *
205 * @param bool $plural
206 * Whether to return the plural version of the title.
449c4e6b 207 */
7b66c3b5 208 public static function getEntityTitle($plural = FALSE) {
812fe84d 209 return $plural ? ts('Custom Field Groups') : ts('Custom Field Group');
449c4e6b
CW
210 }
211
e501603b 212 /**
f41f0342 213 * Returns foreign keys and entity references.
e501603b
TO
214 *
215 * @return array
216 * [CRM_Core_Reference_Interface]
217 */
c3fc2621 218 public static function getReferenceColumns() {
346aaaba 219 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 220 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 221 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
346aaaba 222 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 223 }
346aaaba 224 return Civi::$statics[__CLASS__]['links'];
e501603b 225 }
c3fc2621 226
e501603b
TO
227 /**
228 * Returns all the column names of this table
229 *
230 * @return array
231 */
c3fc2621 232 public static function &fields() {
346aaaba 233 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
234 Civi::$statics[__CLASS__]['fields'] = [
235 'id' => [
e501603b
TO
236 'name' => 'id',
237 'type' => CRM_Utils_Type::T_INT,
c3fc2621 238 'title' => ts('Custom Group ID'),
215b423e 239 'description' => ts('Unique Custom Group ID'),
c3fc2621 240 'required' => TRUE,
a36434b9 241 'where' => 'civicrm_custom_group.id',
522a26c9 242 'table_name' => 'civicrm_custom_group',
243 'entity' => 'CustomGroup',
244 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 245 'localizable' => 0,
2cbbebe8
A
246 'html' => [
247 'type' => 'Number',
248 ],
1fe423d6 249 'readonly' => TRUE,
a9d0587b 250 'add' => '1.1',
c3fc2621
CW
251 ],
252 'name' => [
e501603b
TO
253 'name' => 'name',
254 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 255 'title' => ts('Custom Group Name'),
215b423e 256 'description' => ts('Variable name/programmatic handle for this group.'),
e501603b
TO
257 'maxlength' => 64,
258 'size' => CRM_Utils_Type::BIG,
a36434b9 259 'where' => 'civicrm_custom_group.name',
522a26c9 260 'table_name' => 'civicrm_custom_group',
261 'entity' => 'CustomGroup',
262 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 263 'localizable' => 0,
a9d0587b 264 'add' => '1.1',
c3fc2621
CW
265 ],
266 'title' => [
e501603b
TO
267 'name' => 'title',
268 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 269 'title' => ts('Custom Group Title'),
215b423e 270 'description' => ts('Friendly Name.'),
c3fc2621 271 'required' => TRUE,
e501603b
TO
272 'maxlength' => 64,
273 'size' => CRM_Utils_Type::BIG,
a36434b9 274 'where' => 'civicrm_custom_group.title',
522a26c9 275 'table_name' => 'civicrm_custom_group',
276 'entity' => 'CustomGroup',
277 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 278 'localizable' => 1,
a9d0587b 279 'add' => '1.1',
c3fc2621
CW
280 ],
281 'extends' => [
e501603b
TO
282 'name' => 'extends',
283 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 284 'title' => ts('Custom Group Extends'),
215b423e 285 'description' => ts('Type of object this group extends (can add other options later e.g. contact_address, etc.).'),
e501603b
TO
286 'maxlength' => 255,
287 'size' => CRM_Utils_Type::HUGE,
a36434b9 288 'where' => 'civicrm_custom_group.extends',
e501603b 289 'default' => 'Contact',
522a26c9 290 'table_name' => 'civicrm_custom_group',
291 'entity' => 'CustomGroup',
292 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 293 'localizable' => 0,
c9ac084f
CW
294 'pseudoconstant' => [
295 'callback' => 'CRM_Core_SelectValues::customGroupExtends',
296 ],
a9d0587b 297 'add' => '1.1',
c3fc2621
CW
298 ],
299 'extends_entity_column_id' => [
e501603b
TO
300 'name' => 'extends_entity_column_id',
301 'type' => CRM_Utils_Type::T_INT,
c3fc2621 302 'title' => ts('Custom Group Subtype List'),
215b423e 303 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
a36434b9 304 'where' => 'civicrm_custom_group.extends_entity_column_id',
5fb0de1f 305 'default' => NULL,
522a26c9 306 'table_name' => 'civicrm_custom_group',
307 'entity' => 'CustomGroup',
308 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 309 'localizable' => 0,
233319bf 310 'html' => [
311 'type' => 'Select',
312 ],
313 'pseudoconstant' => [
314 'optionGroupName' => 'custom_data_type',
315 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
e6ca0a57 316 ],
a9d0587b 317 'add' => '2.2',
c3fc2621
CW
318 ],
319 'extends_entity_column_value' => [
e501603b
TO
320 'name' => 'extends_entity_column_value',
321 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 322 'title' => ts('Custom Group Subtype'),
215b423e 323 'description' => ts('linking custom group for dynamic object'),
e501603b
TO
324 'maxlength' => 255,
325 'size' => CRM_Utils_Type::HUGE,
a36434b9 326 'where' => 'civicrm_custom_group.extends_entity_column_value',
522a26c9 327 'table_name' => 'civicrm_custom_group',
328 'entity' => 'CustomGroup',
329 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 330 'localizable' => 0,
2a5c9b4d 331 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
a9d0587b 332 'add' => '1.6',
c3fc2621
CW
333 ],
334 'style' => [
e501603b
TO
335 'name' => 'style',
336 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 337 'title' => ts('Custom Group Style'),
215b423e 338 'description' => ts('Visual relationship between this form and its parent.'),
e501603b
TO
339 'maxlength' => 15,
340 'size' => CRM_Utils_Type::TWELVE,
a36434b9 341 'where' => 'civicrm_custom_group.style',
522a26c9 342 'table_name' => 'civicrm_custom_group',
343 'entity' => 'CustomGroup',
344 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 345 'localizable' => 0,
c3fc2621 346 'html' => [
e501603b 347 'type' => 'Select',
c3fc2621
CW
348 ],
349 'pseudoconstant' => [
e501603b 350 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
e6ca0a57 351 ],
a9d0587b 352 'add' => '1.1',
c3fc2621
CW
353 ],
354 'collapse_display' => [
e501603b 355 'name' => 'collapse_display',
9752268e 356 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 357 'title' => ts('Collapse Custom Group?'),
215b423e 358 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
a36434b9 359 'where' => 'civicrm_custom_group.collapse_display',
45a83e42 360 'default' => '0',
522a26c9 361 'table_name' => 'civicrm_custom_group',
362 'entity' => 'CustomGroup',
363 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 364 'localizable' => 0,
a9d0587b 365 'add' => '1.1',
c3fc2621
CW
366 ],
367 'help_pre' => [
e501603b
TO
368 'name' => 'help_pre',
369 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 370 'title' => ts('Custom Group Pre Text'),
215b423e 371 'description' => ts('Description and/or help text to display before fields in form.'),
e501603b
TO
372 'rows' => 4,
373 'cols' => 80,
a36434b9 374 'where' => 'civicrm_custom_group.help_pre',
522a26c9 375 'table_name' => 'civicrm_custom_group',
376 'entity' => 'CustomGroup',
377 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 378 'localizable' => 1,
c3fc2621 379 'html' => [
e501603b 380 'type' => 'TextArea',
c3fc2621 381 ],
a9d0587b 382 'add' => '1.1',
c3fc2621
CW
383 ],
384 'help_post' => [
e501603b
TO
385 'name' => 'help_post',
386 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 387 'title' => ts('Custom Group Post Text'),
215b423e 388 'description' => ts('Description and/or help text to display after fields in form.'),
e501603b
TO
389 'rows' => 4,
390 'cols' => 80,
a36434b9 391 'where' => 'civicrm_custom_group.help_post',
522a26c9 392 'table_name' => 'civicrm_custom_group',
393 'entity' => 'CustomGroup',
394 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 395 'localizable' => 1,
c3fc2621 396 'html' => [
e501603b 397 'type' => 'TextArea',
c3fc2621 398 ],
a9d0587b 399 'add' => '1.1',
c3fc2621
CW
400 ],
401 'weight' => [
e501603b
TO
402 'name' => 'weight',
403 'type' => CRM_Utils_Type::T_INT,
c3fc2621 404 'title' => ts('Order'),
215b423e 405 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
c3fc2621 406 'required' => TRUE,
a36434b9 407 'where' => 'civicrm_custom_group.weight',
e501603b 408 'default' => '1',
522a26c9 409 'table_name' => 'civicrm_custom_group',
410 'entity' => 'CustomGroup',
411 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 412 'localizable' => 0,
a9d0587b 413 'add' => '1.1',
c3fc2621
CW
414 ],
415 'is_active' => [
e501603b
TO
416 'name' => 'is_active',
417 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 418 'title' => ts('Custom Group Is Active?'),
215b423e 419 'description' => ts('Is this property active?'),
a36434b9 420 'where' => 'civicrm_custom_group.is_active',
110f4343 421 'default' => '1',
522a26c9 422 'table_name' => 'civicrm_custom_group',
423 'entity' => 'CustomGroup',
424 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 425 'localizable' => 0,
a9d0587b 426 'add' => '1.1',
c3fc2621
CW
427 ],
428 'table_name' => [
e501603b
TO
429 'name' => 'table_name',
430 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 431 'title' => ts('Table Name'),
215b423e 432 'description' => ts('Name of the table that holds the values for this group.'),
e501603b
TO
433 'maxlength' => 255,
434 'size' => CRM_Utils_Type::HUGE,
a36434b9 435 'where' => 'civicrm_custom_group.table_name',
522a26c9 436 'table_name' => 'civicrm_custom_group',
437 'entity' => 'CustomGroup',
438 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 439 'localizable' => 0,
c23563e3
SL
440 'html' => [
441 'label' => ts("Table Name"),
442 ],
88620a59 443 'readonly' => TRUE,
a9d0587b 444 'add' => '2.0',
c3fc2621
CW
445 ],
446 'is_multiple' => [
e501603b
TO
447 'name' => 'is_multiple',
448 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 449 'title' => ts('Supports Multiple Records'),
215b423e 450 'description' => ts('Does this group hold multiple values?'),
a36434b9 451 'where' => 'civicrm_custom_group.is_multiple',
45a83e42 452 'default' => '0',
522a26c9 453 'table_name' => 'civicrm_custom_group',
454 'entity' => 'CustomGroup',
455 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 456 'localizable' => 0,
a9d0587b 457 'add' => '2.0',
c3fc2621
CW
458 ],
459 'min_multiple' => [
e501603b
TO
460 'name' => 'min_multiple',
461 'type' => CRM_Utils_Type::T_INT,
c3fc2621 462 'title' => ts('Minimum Multiple Records'),
215b423e 463 'description' => ts('minimum number of multiple records (typically 0?)'),
a36434b9 464 'where' => 'civicrm_custom_group.min_multiple',
522a26c9 465 'table_name' => 'civicrm_custom_group',
466 'entity' => 'CustomGroup',
467 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 468 'localizable' => 0,
a9d0587b 469 'add' => '2.2',
c3fc2621
CW
470 ],
471 'max_multiple' => [
e501603b
TO
472 'name' => 'max_multiple',
473 'type' => CRM_Utils_Type::T_INT,
c3fc2621 474 'title' => ts('Maximum Multiple Records'),
215b423e 475 'description' => ts('maximum number of multiple records, if 0 - no max'),
a36434b9 476 'where' => 'civicrm_custom_group.max_multiple',
522a26c9 477 'table_name' => 'civicrm_custom_group',
478 'entity' => 'CustomGroup',
479 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 480 'localizable' => 0,
a9d0587b 481 'add' => '2.2',
c3fc2621
CW
482 ],
483 'collapse_adv_display' => [
e501603b 484 'name' => 'collapse_adv_display',
9752268e 485 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 486 'title' => ts('Collapse Group Display'),
215b423e 487 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
a36434b9 488 'where' => 'civicrm_custom_group.collapse_adv_display',
45a83e42 489 'default' => '0',
522a26c9 490 'table_name' => 'civicrm_custom_group',
491 'entity' => 'CustomGroup',
492 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 493 'localizable' => 0,
a9d0587b 494 'add' => '3.0',
c3fc2621
CW
495 ],
496 'created_id' => [
e501603b
TO
497 'name' => 'created_id',
498 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 499 'title' => ts('Created By Contact ID'),
215b423e 500 'description' => ts('FK to civicrm_contact, who created this custom group'),
a36434b9 501 'where' => 'civicrm_custom_group.created_id',
522a26c9 502 'table_name' => 'civicrm_custom_group',
503 'entity' => 'CustomGroup',
504 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 505 'localizable' => 0,
e501603b 506 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
507 'html' => [
508 'label' => ts("Created By"),
509 ],
a9d0587b 510 'add' => '3.0',
c3fc2621
CW
511 ],
512 'created_date' => [
e501603b
TO
513 'name' => 'created_date',
514 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 515 'title' => ts('Custom Group Created Date'),
215b423e 516 'description' => ts('Date and time this custom group was created.'),
a36434b9 517 'where' => 'civicrm_custom_group.created_date',
522a26c9 518 'table_name' => 'civicrm_custom_group',
519 'entity' => 'CustomGroup',
520 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 521 'localizable' => 0,
a9d0587b 522 'add' => '3.0',
c3fc2621
CW
523 ],
524 'is_reserved' => [
e501603b
TO
525 'name' => 'is_reserved',
526 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 527 'title' => ts('Reserved Group?'),
215b423e 528 'description' => ts('Is this a reserved Custom Group?'),
a36434b9 529 'where' => 'civicrm_custom_group.is_reserved',
45a83e42 530 'default' => '0',
522a26c9 531 'table_name' => 'civicrm_custom_group',
532 'entity' => 'CustomGroup',
533 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 534 'localizable' => 0,
a9d0587b 535 'add' => '4.4',
c3fc2621
CW
536 ],
537 'is_public' => [
460931ca
JP
538 'name' => 'is_public',
539 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 540 'title' => ts('Custom Group Is Public?'),
215b423e 541 'description' => ts('Is this property public?'),
a36434b9 542 'where' => 'civicrm_custom_group.is_public',
460931ca
JP
543 'default' => '1',
544 'table_name' => 'civicrm_custom_group',
545 'entity' => 'CustomGroup',
546 'bao' => 'CRM_Core_BAO_CustomGroup',
547 'localizable' => 0,
a9d0587b 548 'add' => '4.7',
c3fc2621 549 ],
2af06525
CW
550 'icon' => [
551 'name' => 'icon',
552 'type' => CRM_Utils_Type::T_STRING,
553 'title' => ts('Icon'),
554 'description' => ts('crm-i icon class'),
555 'maxlength' => 255,
556 'size' => CRM_Utils_Type::HUGE,
557 'where' => 'civicrm_custom_group.icon',
5fb0de1f 558 'default' => NULL,
2af06525
CW
559 'table_name' => 'civicrm_custom_group',
560 'entity' => 'CustomGroup',
561 'bao' => 'CRM_Core_BAO_CustomGroup',
562 'localizable' => 0,
a9d0587b 563 'add' => '5.28',
2af06525 564 ],
c3fc2621 565 ];
346aaaba 566 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 567 }
346aaaba 568 return Civi::$statics[__CLASS__]['fields'];
e501603b 569 }
c3fc2621 570
e501603b 571 /**
bd8e0b14 572 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
573 *
574 * @return array
bd8e0b14 575 * Array(string $name => string $uniqueName).
e501603b 576 */
c3fc2621 577 public static function &fieldKeys() {
bd8e0b14
TO
578 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
579 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 580 }
bd8e0b14 581 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 582 }
c3fc2621 583
e501603b
TO
584 /**
585 * Returns the names of this table
586 *
587 * @return string
588 */
c3fc2621 589 public static function getTableName() {
e501603b
TO
590 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
591 }
c3fc2621 592
e501603b
TO
593 /**
594 * Returns if this table needs to be logged
595 *
c3fc2621 596 * @return bool
e501603b 597 */
c3fc2621 598 public function getLog() {
e501603b
TO
599 return self::$_log;
600 }
c3fc2621 601
e501603b
TO
602 /**
603 * Returns the list of fields that can be imported
604 *
605 * @param bool $prefix
606 *
607 * @return array
608 */
c3fc2621
CW
609 public static function &import($prefix = FALSE) {
610 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
60808919 611 return $r;
e501603b 612 }
c3fc2621 613
e501603b
TO
614 /**
615 * Returns the list of fields that can be exported
616 *
617 * @param bool $prefix
618 *
619 * @return array
620 */
c3fc2621
CW
621 public static function &export($prefix = FALSE) {
622 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
60808919 623 return $r;
e501603b 624 }
c3fc2621 625
e7a6b91a
AS
626 /**
627 * Returns the list of indices
c3fc2621
CW
628 *
629 * @param bool $localize
630 *
631 * @return array
e7a6b91a
AS
632 */
633 public static function indices($localize = TRUE) {
c3fc2621
CW
634 $indices = [
635 'UI_title_extends' => [
e7a6b91a 636 'name' => 'UI_title_extends',
c3fc2621 637 'field' => [
e7a6b91a
AS
638 0 => 'title',
639 1 => 'extends',
c3fc2621
CW
640 ],
641 'localizable' => TRUE,
642 'unique' => TRUE,
e7a6b91a 643 'sig' => 'civicrm_custom_group::1::title::extends',
c3fc2621
CW
644 ],
645 'UI_name_extends' => [
e7a6b91a 646 'name' => 'UI_name_extends',
c3fc2621 647 'field' => [
e7a6b91a
AS
648 0 => 'name',
649 1 => 'extends',
c3fc2621
CW
650 ],
651 'localizable' => FALSE,
652 'unique' => TRUE,
e7a6b91a 653 'sig' => 'civicrm_custom_group::1::name::extends',
c3fc2621
CW
654 ],
655 ];
e7a6b91a
AS
656 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
657 }
c3fc2621 658
e501603b 659}