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