Merge pull request #22138 from eileenmcnaughton/cust_edit
[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
812fe84d 9 * (GenCodeChecksum:e06fe97917806daa0d337c43968ccf2b)
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,
a9d0587b 294 'add' => '1.1',
c3fc2621
CW
295 ],
296 'extends_entity_column_id' => [
e501603b
TO
297 'name' => 'extends_entity_column_id',
298 'type' => CRM_Utils_Type::T_INT,
c3fc2621 299 'title' => ts('Custom Group Subtype List'),
215b423e 300 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
a36434b9 301 'where' => 'civicrm_custom_group.extends_entity_column_id',
5fb0de1f 302 'default' => NULL,
522a26c9 303 'table_name' => 'civicrm_custom_group',
304 'entity' => 'CustomGroup',
305 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 306 'localizable' => 0,
233319bf 307 'html' => [
308 'type' => 'Select',
309 ],
310 'pseudoconstant' => [
311 'optionGroupName' => 'custom_data_type',
312 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
e6ca0a57 313 ],
a9d0587b 314 'add' => '2.2',
c3fc2621
CW
315 ],
316 'extends_entity_column_value' => [
e501603b
TO
317 'name' => 'extends_entity_column_value',
318 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 319 'title' => ts('Custom Group Subtype'),
215b423e 320 'description' => ts('linking custom group for dynamic object'),
e501603b
TO
321 'maxlength' => 255,
322 'size' => CRM_Utils_Type::HUGE,
a36434b9 323 'where' => 'civicrm_custom_group.extends_entity_column_value',
522a26c9 324 'table_name' => 'civicrm_custom_group',
325 'entity' => 'CustomGroup',
326 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 327 'localizable' => 0,
2a5c9b4d 328 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
a9d0587b 329 'add' => '1.6',
c3fc2621
CW
330 ],
331 'style' => [
e501603b
TO
332 'name' => 'style',
333 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 334 'title' => ts('Custom Group Style'),
215b423e 335 'description' => ts('Visual relationship between this form and its parent.'),
e501603b
TO
336 'maxlength' => 15,
337 'size' => CRM_Utils_Type::TWELVE,
a36434b9 338 'where' => 'civicrm_custom_group.style',
522a26c9 339 'table_name' => 'civicrm_custom_group',
340 'entity' => 'CustomGroup',
341 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 342 'localizable' => 0,
c3fc2621 343 'html' => [
e501603b 344 'type' => 'Select',
c3fc2621
CW
345 ],
346 'pseudoconstant' => [
e501603b 347 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
e6ca0a57 348 ],
a9d0587b 349 'add' => '1.1',
c3fc2621
CW
350 ],
351 'collapse_display' => [
e501603b 352 'name' => 'collapse_display',
9752268e 353 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 354 'title' => ts('Collapse Custom Group?'),
215b423e 355 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
a36434b9 356 'where' => 'civicrm_custom_group.collapse_display',
45a83e42 357 'default' => '0',
522a26c9 358 'table_name' => 'civicrm_custom_group',
359 'entity' => 'CustomGroup',
360 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 361 'localizable' => 0,
a9d0587b 362 'add' => '1.1',
c3fc2621
CW
363 ],
364 'help_pre' => [
e501603b
TO
365 'name' => 'help_pre',
366 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 367 'title' => ts('Custom Group Pre Text'),
215b423e 368 'description' => ts('Description and/or help text to display before fields in form.'),
e501603b
TO
369 'rows' => 4,
370 'cols' => 80,
a36434b9 371 'where' => 'civicrm_custom_group.help_pre',
522a26c9 372 'table_name' => 'civicrm_custom_group',
373 'entity' => 'CustomGroup',
374 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 375 'localizable' => 1,
c3fc2621 376 'html' => [
e501603b 377 'type' => 'TextArea',
c3fc2621 378 ],
a9d0587b 379 'add' => '1.1',
c3fc2621
CW
380 ],
381 'help_post' => [
e501603b
TO
382 'name' => 'help_post',
383 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 384 'title' => ts('Custom Group Post Text'),
215b423e 385 'description' => ts('Description and/or help text to display after fields in form.'),
e501603b
TO
386 'rows' => 4,
387 'cols' => 80,
a36434b9 388 'where' => 'civicrm_custom_group.help_post',
522a26c9 389 'table_name' => 'civicrm_custom_group',
390 'entity' => 'CustomGroup',
391 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 392 'localizable' => 1,
c3fc2621 393 'html' => [
e501603b 394 'type' => 'TextArea',
c3fc2621 395 ],
a9d0587b 396 'add' => '1.1',
c3fc2621
CW
397 ],
398 'weight' => [
e501603b
TO
399 'name' => 'weight',
400 'type' => CRM_Utils_Type::T_INT,
c3fc2621 401 'title' => ts('Order'),
215b423e 402 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
c3fc2621 403 'required' => TRUE,
a36434b9 404 'where' => 'civicrm_custom_group.weight',
e501603b 405 'default' => '1',
522a26c9 406 'table_name' => 'civicrm_custom_group',
407 'entity' => 'CustomGroup',
408 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 409 'localizable' => 0,
a9d0587b 410 'add' => '1.1',
c3fc2621
CW
411 ],
412 'is_active' => [
e501603b
TO
413 'name' => 'is_active',
414 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 415 'title' => ts('Custom Group Is Active?'),
215b423e 416 'description' => ts('Is this property active?'),
a36434b9 417 'where' => 'civicrm_custom_group.is_active',
110f4343 418 'default' => '1',
522a26c9 419 'table_name' => 'civicrm_custom_group',
420 'entity' => 'CustomGroup',
421 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 422 'localizable' => 0,
a9d0587b 423 'add' => '1.1',
c3fc2621
CW
424 ],
425 'table_name' => [
e501603b
TO
426 'name' => 'table_name',
427 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 428 'title' => ts('Table Name'),
215b423e 429 'description' => ts('Name of the table that holds the values for this group.'),
e501603b
TO
430 'maxlength' => 255,
431 'size' => CRM_Utils_Type::HUGE,
a36434b9 432 'where' => 'civicrm_custom_group.table_name',
522a26c9 433 'table_name' => 'civicrm_custom_group',
434 'entity' => 'CustomGroup',
435 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 436 'localizable' => 0,
c23563e3
SL
437 'html' => [
438 'label' => ts("Table Name"),
439 ],
88620a59 440 'readonly' => TRUE,
a9d0587b 441 'add' => '2.0',
c3fc2621
CW
442 ],
443 'is_multiple' => [
e501603b
TO
444 'name' => 'is_multiple',
445 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 446 'title' => ts('Supports Multiple Records'),
215b423e 447 'description' => ts('Does this group hold multiple values?'),
a36434b9 448 'where' => 'civicrm_custom_group.is_multiple',
45a83e42 449 'default' => '0',
522a26c9 450 'table_name' => 'civicrm_custom_group',
451 'entity' => 'CustomGroup',
452 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 453 'localizable' => 0,
a9d0587b 454 'add' => '2.0',
c3fc2621
CW
455 ],
456 'min_multiple' => [
e501603b
TO
457 'name' => 'min_multiple',
458 'type' => CRM_Utils_Type::T_INT,
c3fc2621 459 'title' => ts('Minimum Multiple Records'),
215b423e 460 'description' => ts('minimum number of multiple records (typically 0?)'),
a36434b9 461 'where' => 'civicrm_custom_group.min_multiple',
522a26c9 462 'table_name' => 'civicrm_custom_group',
463 'entity' => 'CustomGroup',
464 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 465 'localizable' => 0,
a9d0587b 466 'add' => '2.2',
c3fc2621
CW
467 ],
468 'max_multiple' => [
e501603b
TO
469 'name' => 'max_multiple',
470 'type' => CRM_Utils_Type::T_INT,
c3fc2621 471 'title' => ts('Maximum Multiple Records'),
215b423e 472 'description' => ts('maximum number of multiple records, if 0 - no max'),
a36434b9 473 'where' => 'civicrm_custom_group.max_multiple',
522a26c9 474 'table_name' => 'civicrm_custom_group',
475 'entity' => 'CustomGroup',
476 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 477 'localizable' => 0,
a9d0587b 478 'add' => '2.2',
c3fc2621
CW
479 ],
480 'collapse_adv_display' => [
e501603b 481 'name' => 'collapse_adv_display',
9752268e 482 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 483 'title' => ts('Collapse Group Display'),
215b423e 484 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
a36434b9 485 'where' => 'civicrm_custom_group.collapse_adv_display',
45a83e42 486 'default' => '0',
522a26c9 487 'table_name' => 'civicrm_custom_group',
488 'entity' => 'CustomGroup',
489 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 490 'localizable' => 0,
a9d0587b 491 'add' => '3.0',
c3fc2621
CW
492 ],
493 'created_id' => [
e501603b
TO
494 'name' => 'created_id',
495 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 496 'title' => ts('Created By Contact ID'),
215b423e 497 'description' => ts('FK to civicrm_contact, who created this custom group'),
a36434b9 498 'where' => 'civicrm_custom_group.created_id',
522a26c9 499 'table_name' => 'civicrm_custom_group',
500 'entity' => 'CustomGroup',
501 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 502 'localizable' => 0,
e501603b 503 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
504 'html' => [
505 'label' => ts("Created By"),
506 ],
a9d0587b 507 'add' => '3.0',
c3fc2621
CW
508 ],
509 'created_date' => [
e501603b
TO
510 'name' => 'created_date',
511 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 512 'title' => ts('Custom Group Created Date'),
215b423e 513 'description' => ts('Date and time this custom group was created.'),
a36434b9 514 'where' => 'civicrm_custom_group.created_date',
522a26c9 515 'table_name' => 'civicrm_custom_group',
516 'entity' => 'CustomGroup',
517 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 518 'localizable' => 0,
a9d0587b 519 'add' => '3.0',
c3fc2621
CW
520 ],
521 'is_reserved' => [
e501603b
TO
522 'name' => 'is_reserved',
523 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 524 'title' => ts('Reserved Group?'),
215b423e 525 'description' => ts('Is this a reserved Custom Group?'),
a36434b9 526 'where' => 'civicrm_custom_group.is_reserved',
45a83e42 527 'default' => '0',
522a26c9 528 'table_name' => 'civicrm_custom_group',
529 'entity' => 'CustomGroup',
530 'bao' => 'CRM_Core_BAO_CustomGroup',
6a7e5e5d 531 'localizable' => 0,
a9d0587b 532 'add' => '4.4',
c3fc2621
CW
533 ],
534 'is_public' => [
460931ca
JP
535 'name' => 'is_public',
536 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 537 'title' => ts('Custom Group Is Public?'),
215b423e 538 'description' => ts('Is this property public?'),
a36434b9 539 'where' => 'civicrm_custom_group.is_public',
460931ca
JP
540 'default' => '1',
541 'table_name' => 'civicrm_custom_group',
542 'entity' => 'CustomGroup',
543 'bao' => 'CRM_Core_BAO_CustomGroup',
544 'localizable' => 0,
a9d0587b 545 'add' => '4.7',
c3fc2621 546 ],
2af06525
CW
547 'icon' => [
548 'name' => 'icon',
549 'type' => CRM_Utils_Type::T_STRING,
550 'title' => ts('Icon'),
551 'description' => ts('crm-i icon class'),
552 'maxlength' => 255,
553 'size' => CRM_Utils_Type::HUGE,
554 'where' => 'civicrm_custom_group.icon',
5fb0de1f 555 'default' => NULL,
2af06525
CW
556 'table_name' => 'civicrm_custom_group',
557 'entity' => 'CustomGroup',
558 'bao' => 'CRM_Core_BAO_CustomGroup',
559 'localizable' => 0,
a9d0587b 560 'add' => '5.28',
2af06525 561 ],
c3fc2621 562 ];
346aaaba 563 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 564 }
346aaaba 565 return Civi::$statics[__CLASS__]['fields'];
e501603b 566 }
c3fc2621 567
e501603b 568 /**
bd8e0b14 569 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
570 *
571 * @return array
bd8e0b14 572 * Array(string $name => string $uniqueName).
e501603b 573 */
c3fc2621 574 public static function &fieldKeys() {
bd8e0b14
TO
575 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
576 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 577 }
bd8e0b14 578 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 579 }
c3fc2621 580
e501603b
TO
581 /**
582 * Returns the names of this table
583 *
584 * @return string
585 */
c3fc2621 586 public static function getTableName() {
e501603b
TO
587 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
588 }
c3fc2621 589
e501603b
TO
590 /**
591 * Returns if this table needs to be logged
592 *
c3fc2621 593 * @return bool
e501603b 594 */
c3fc2621 595 public function getLog() {
e501603b
TO
596 return self::$_log;
597 }
c3fc2621 598
e501603b
TO
599 /**
600 * Returns the list of fields that can be imported
601 *
602 * @param bool $prefix
603 *
604 * @return array
605 */
c3fc2621
CW
606 public static function &import($prefix = FALSE) {
607 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
60808919 608 return $r;
e501603b 609 }
c3fc2621 610
e501603b
TO
611 /**
612 * Returns the list of fields that can be exported
613 *
614 * @param bool $prefix
615 *
616 * @return array
617 */
c3fc2621
CW
618 public static function &export($prefix = FALSE) {
619 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
60808919 620 return $r;
e501603b 621 }
c3fc2621 622
e7a6b91a
AS
623 /**
624 * Returns the list of indices
c3fc2621
CW
625 *
626 * @param bool $localize
627 *
628 * @return array
e7a6b91a
AS
629 */
630 public static function indices($localize = TRUE) {
c3fc2621
CW
631 $indices = [
632 'UI_title_extends' => [
e7a6b91a 633 'name' => 'UI_title_extends',
c3fc2621 634 'field' => [
e7a6b91a
AS
635 0 => 'title',
636 1 => 'extends',
c3fc2621
CW
637 ],
638 'localizable' => TRUE,
639 'unique' => TRUE,
e7a6b91a 640 'sig' => 'civicrm_custom_group::1::title::extends',
c3fc2621
CW
641 ],
642 'UI_name_extends' => [
e7a6b91a 643 'name' => 'UI_name_extends',
c3fc2621 644 'field' => [
e7a6b91a
AS
645 0 => 'name',
646 1 => 'extends',
c3fc2621
CW
647 ],
648 'localizable' => FALSE,
649 'unique' => TRUE,
e7a6b91a 650 'sig' => 'civicrm_custom_group::1::name::extends',
c3fc2621
CW
651 ],
652 ];
e7a6b91a
AS
653 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
654 }
c3fc2621 655
e501603b 656}