5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:57ebfb396e58116709f9d883a46edfa7)
13 * Database access object for the CustomGroup entity.
15 class CRM_Core_DAO_CustomGroup
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_custom_group';
27 * Field to show when displaying a record.
31 public static $_labelField = 'title';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = TRUE;
41 * Paths for accessing this entity in the UI.
45 protected static $_paths = [
46 'add' => 'civicrm/admin/custom/group?action=add&reset=1',
47 'update' => 'civicrm/admin/custom/group?action=update&reset=1&id=[id]',
48 'preview' => 'civicrm/admin/custom/group?action=preview&reset=1&id=[id]',
49 'delete' => 'civicrm/admin/custom/group?action=delete&reset=1&id=[id]',
53 * Unique Custom Group ID
60 * Variable name/programmatic handle for this group.
74 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
81 * FK to civicrm_option_value.id (for option group custom_data_type.)
85 public $extends_entity_column_id;
88 * linking custom group for dynamic object
92 public $extends_entity_column_value;
95 * Visual relationship between this form and its parent.
102 * Will this group be in collapsed or expanded mode on initial display ?
106 public $collapse_display;
109 * Description and/or help text to display before fields in form.
116 * Description and/or help text to display after fields in form.
123 * Controls display order when multiple extended property groups are setup for the same class.
130 * Is this property active?
137 * Name of the table that holds the values for this group.
144 * Does this group hold multiple values?
151 * minimum number of multiple records (typically 0?)
155 public $min_multiple;
158 * maximum number of multiple records, if 0 - no max
162 public $max_multiple;
165 * Will this group be in collapsed or expanded mode on advanced search display ?
169 public $collapse_adv_display;
172 * FK to civicrm_contact, who created this custom group
179 * Date and time this custom group was created.
183 public $created_date;
186 * Is this a reserved Custom Group?
193 * Is this property public?
209 public function __construct() {
210 $this->__table
= 'civicrm_custom_group';
211 parent
::__construct();
215 * Returns localized title of this entity.
217 * @param bool $plural
218 * Whether to return the plural version of the title.
220 public static function getEntityTitle($plural = FALSE) {
221 return $plural ?
ts('Custom Field Groups') : ts('Custom Field Group');
225 * Returns foreign keys and entity references.
228 * [CRM_Core_Reference_Interface]
230 public static function getReferenceColumns() {
231 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
232 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
233 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
234 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
236 return Civi
::$statics[__CLASS__
]['links'];
240 * Returns all the column names of this table
244 public static function &fields() {
245 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
246 Civi
::$statics[__CLASS__
]['fields'] = [
249 'type' => CRM_Utils_Type
::T_INT
,
250 'title' => ts('Custom Group ID'),
251 'description' => ts('Unique Custom Group ID'),
253 'where' => 'civicrm_custom_group.id',
254 'table_name' => 'civicrm_custom_group',
255 'entity' => 'CustomGroup',
256 'bao' => 'CRM_Core_BAO_CustomGroup',
266 'type' => CRM_Utils_Type
::T_STRING
,
267 'title' => ts('Custom Group Name'),
268 'description' => ts('Variable name/programmatic handle for this group.'),
270 'size' => CRM_Utils_Type
::BIG
,
271 'where' => 'civicrm_custom_group.name',
272 'table_name' => 'civicrm_custom_group',
273 'entity' => 'CustomGroup',
274 'bao' => 'CRM_Core_BAO_CustomGroup',
280 'type' => CRM_Utils_Type
::T_STRING
,
281 'title' => ts('Custom Group Title'),
282 'description' => ts('Friendly Name.'),
285 'size' => CRM_Utils_Type
::BIG
,
286 'where' => 'civicrm_custom_group.title',
287 'table_name' => 'civicrm_custom_group',
288 'entity' => 'CustomGroup',
289 'bao' => 'CRM_Core_BAO_CustomGroup',
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('Custom Group Extends'),
297 'description' => ts('Type of object this group extends (can add other options later e.g. contact_address, etc.).'),
299 'size' => CRM_Utils_Type
::HUGE
,
300 'where' => 'civicrm_custom_group.extends',
301 'default' => 'Contact',
302 'table_name' => 'civicrm_custom_group',
303 'entity' => 'CustomGroup',
304 'bao' => 'CRM_Core_BAO_CustomGroup',
306 'pseudoconstant' => [
307 'callback' => 'CRM_Core_SelectValues::customGroupExtends',
311 'extends_entity_column_id' => [
312 'name' => 'extends_entity_column_id',
313 'type' => CRM_Utils_Type
::T_INT
,
314 'title' => ts('Custom Group Subtype List'),
315 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
316 'where' => 'civicrm_custom_group.extends_entity_column_id',
318 'table_name' => 'civicrm_custom_group',
319 'entity' => 'CustomGroup',
320 'bao' => 'CRM_Core_BAO_CustomGroup',
325 'pseudoconstant' => [
326 'optionGroupName' => 'custom_data_type',
327 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
331 'extends_entity_column_value' => [
332 'name' => 'extends_entity_column_value',
333 'type' => CRM_Utils_Type
::T_STRING
,
334 'title' => ts('Custom Group Subtype'),
335 'description' => ts('linking custom group for dynamic object'),
337 'size' => CRM_Utils_Type
::HUGE
,
338 'where' => 'civicrm_custom_group.extends_entity_column_value',
339 'table_name' => 'civicrm_custom_group',
340 'entity' => 'CustomGroup',
341 'bao' => 'CRM_Core_BAO_CustomGroup',
343 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
348 'type' => CRM_Utils_Type
::T_STRING
,
349 'title' => ts('Custom Group Style'),
350 'description' => ts('Visual relationship between this form and its parent.'),
352 'size' => CRM_Utils_Type
::TWELVE
,
353 'where' => 'civicrm_custom_group.style',
354 'table_name' => 'civicrm_custom_group',
355 'entity' => 'CustomGroup',
356 'bao' => 'CRM_Core_BAO_CustomGroup',
361 'pseudoconstant' => [
362 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
366 'collapse_display' => [
367 'name' => 'collapse_display',
368 'type' => CRM_Utils_Type
::T_BOOLEAN
,
369 'title' => ts('Collapse Custom Group?'),
370 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
371 'where' => 'civicrm_custom_group.collapse_display',
373 'table_name' => 'civicrm_custom_group',
374 'entity' => 'CustomGroup',
375 'bao' => 'CRM_Core_BAO_CustomGroup',
380 'name' => 'help_pre',
381 'type' => CRM_Utils_Type
::T_TEXT
,
382 'title' => ts('Custom Group Pre Text'),
383 'description' => ts('Description and/or help text to display before fields in form.'),
386 'where' => 'civicrm_custom_group.help_pre',
387 'table_name' => 'civicrm_custom_group',
388 'entity' => 'CustomGroup',
389 'bao' => 'CRM_Core_BAO_CustomGroup',
392 'type' => 'TextArea',
397 'name' => 'help_post',
398 'type' => CRM_Utils_Type
::T_TEXT
,
399 'title' => ts('Custom Group Post Text'),
400 'description' => ts('Description and/or help text to display after fields in form.'),
403 'where' => 'civicrm_custom_group.help_post',
404 'table_name' => 'civicrm_custom_group',
405 'entity' => 'CustomGroup',
406 'bao' => 'CRM_Core_BAO_CustomGroup',
409 'type' => 'TextArea',
415 'type' => CRM_Utils_Type
::T_INT
,
416 'title' => ts('Order'),
417 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
419 'where' => 'civicrm_custom_group.weight',
421 'table_name' => 'civicrm_custom_group',
422 'entity' => 'CustomGroup',
423 'bao' => 'CRM_Core_BAO_CustomGroup',
428 'name' => 'is_active',
429 'type' => CRM_Utils_Type
::T_BOOLEAN
,
430 'title' => ts('Custom Group Is Active?'),
431 'description' => ts('Is this property active?'),
432 'where' => 'civicrm_custom_group.is_active',
434 'table_name' => 'civicrm_custom_group',
435 'entity' => 'CustomGroup',
436 'bao' => 'CRM_Core_BAO_CustomGroup',
441 'name' => 'table_name',
442 'type' => CRM_Utils_Type
::T_STRING
,
443 'title' => ts('Table Name'),
444 'description' => ts('Name of the table that holds the values for this group.'),
446 'size' => CRM_Utils_Type
::HUGE
,
447 'where' => 'civicrm_custom_group.table_name',
448 'table_name' => 'civicrm_custom_group',
449 'entity' => 'CustomGroup',
450 'bao' => 'CRM_Core_BAO_CustomGroup',
453 'label' => ts("Table Name"),
459 'name' => 'is_multiple',
460 'type' => CRM_Utils_Type
::T_BOOLEAN
,
461 'title' => ts('Supports Multiple Records'),
462 'description' => ts('Does this group hold multiple values?'),
463 'where' => 'civicrm_custom_group.is_multiple',
465 'table_name' => 'civicrm_custom_group',
466 'entity' => 'CustomGroup',
467 'bao' => 'CRM_Core_BAO_CustomGroup',
472 'name' => 'min_multiple',
473 'type' => CRM_Utils_Type
::T_INT
,
474 'title' => ts('Minimum Multiple Records'),
475 'description' => ts('minimum number of multiple records (typically 0?)'),
476 'where' => 'civicrm_custom_group.min_multiple',
477 'table_name' => 'civicrm_custom_group',
478 'entity' => 'CustomGroup',
479 'bao' => 'CRM_Core_BAO_CustomGroup',
484 'name' => 'max_multiple',
485 'type' => CRM_Utils_Type
::T_INT
,
486 'title' => ts('Maximum Multiple Records'),
487 'description' => ts('maximum number of multiple records, if 0 - no max'),
488 'where' => 'civicrm_custom_group.max_multiple',
489 'table_name' => 'civicrm_custom_group',
490 'entity' => 'CustomGroup',
491 'bao' => 'CRM_Core_BAO_CustomGroup',
495 'collapse_adv_display' => [
496 'name' => 'collapse_adv_display',
497 'type' => CRM_Utils_Type
::T_BOOLEAN
,
498 'title' => ts('Collapse Group Display'),
499 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
500 'where' => 'civicrm_custom_group.collapse_adv_display',
502 'table_name' => 'civicrm_custom_group',
503 'entity' => 'CustomGroup',
504 'bao' => 'CRM_Core_BAO_CustomGroup',
509 'name' => 'created_id',
510 'type' => CRM_Utils_Type
::T_INT
,
511 'title' => ts('Created By Contact ID'),
512 'description' => ts('FK to civicrm_contact, who created this custom group'),
513 'where' => 'civicrm_custom_group.created_id',
514 'table_name' => 'civicrm_custom_group',
515 'entity' => 'CustomGroup',
516 'bao' => 'CRM_Core_BAO_CustomGroup',
518 'FKClassName' => 'CRM_Contact_DAO_Contact',
520 'label' => ts("Created By"),
525 'name' => 'created_date',
526 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
527 'title' => ts('Custom Group Created Date'),
528 'description' => ts('Date and time this custom group was created.'),
529 'where' => 'civicrm_custom_group.created_date',
530 'table_name' => 'civicrm_custom_group',
531 'entity' => 'CustomGroup',
532 'bao' => 'CRM_Core_BAO_CustomGroup',
537 'name' => 'is_reserved',
538 'type' => CRM_Utils_Type
::T_BOOLEAN
,
539 'title' => ts('Reserved Group?'),
540 'description' => ts('Is this a reserved Custom Group?'),
541 'where' => 'civicrm_custom_group.is_reserved',
543 'table_name' => 'civicrm_custom_group',
544 'entity' => 'CustomGroup',
545 'bao' => 'CRM_Core_BAO_CustomGroup',
550 'name' => 'is_public',
551 'type' => CRM_Utils_Type
::T_BOOLEAN
,
552 'title' => ts('Custom Group Is Public?'),
553 'description' => ts('Is this property public?'),
554 'where' => 'civicrm_custom_group.is_public',
556 'table_name' => 'civicrm_custom_group',
557 'entity' => 'CustomGroup',
558 'bao' => 'CRM_Core_BAO_CustomGroup',
564 'type' => CRM_Utils_Type
::T_STRING
,
565 'title' => ts('Icon'),
566 'description' => ts('crm-i icon class'),
568 'size' => CRM_Utils_Type
::HUGE
,
569 'where' => 'civicrm_custom_group.icon',
571 'table_name' => 'civicrm_custom_group',
572 'entity' => 'CustomGroup',
573 'bao' => 'CRM_Core_BAO_CustomGroup',
578 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
580 return Civi
::$statics[__CLASS__
]['fields'];
584 * Return a mapping from field-name to the corresponding key (as used in fields()).
587 * Array(string $name => string $uniqueName).
589 public static function &fieldKeys() {
590 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
591 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
593 return Civi
::$statics[__CLASS__
]['fieldKeys'];
597 * Returns the names of this table
601 public static function getTableName() {
602 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
606 * Returns if this table needs to be logged
610 public function getLog() {
615 * Returns the list of fields that can be imported
617 * @param bool $prefix
621 public static function &import($prefix = FALSE) {
622 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'custom_group', $prefix, []);
627 * Returns the list of fields that can be exported
629 * @param bool $prefix
633 public static function &export($prefix = FALSE) {
634 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'custom_group', $prefix, []);
639 * Returns the list of indices
641 * @param bool $localize
645 public static function indices($localize = TRUE) {
647 'UI_title_extends' => [
648 'name' => 'UI_title_extends',
653 'localizable' => TRUE,
655 'sig' => 'civicrm_custom_group::1::title::extends',
657 'UI_name_extends' => [
658 'name' => 'UI_name_extends',
663 'localizable' => FALSE,
665 'sig' => 'civicrm_custom_group::1::name::extends',
668 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;