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