| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Core/CustomField.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:73d7ccebba6055cae4fa0c9d797025c4) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the CustomField entity. |
| 14 | */ |
| 15 | class CRM_Core_DAO_CustomField extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | static $_tableName = 'civicrm_custom_field'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | static $_log = TRUE; |
| 30 | |
| 31 | /** |
| 32 | * Unique Custom Field ID |
| 33 | * |
| 34 | * @var int unsigned |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * FK to civicrm_custom_group. |
| 40 | * |
| 41 | * @var int unsigned |
| 42 | */ |
| 43 | public $custom_group_id; |
| 44 | |
| 45 | /** |
| 46 | * Variable name/programmatic handle for this group. |
| 47 | * |
| 48 | * @var string |
| 49 | */ |
| 50 | public $name; |
| 51 | |
| 52 | /** |
| 53 | * Text for form field label (also friendly name for administering this custom property). |
| 54 | * |
| 55 | * @var string |
| 56 | */ |
| 57 | public $label; |
| 58 | |
| 59 | /** |
| 60 | * Controls location of data storage in extended_data table. |
| 61 | * |
| 62 | * @var string |
| 63 | */ |
| 64 | public $data_type; |
| 65 | |
| 66 | /** |
| 67 | * HTML types plus several built-in extended types. |
| 68 | * |
| 69 | * @var string |
| 70 | */ |
| 71 | public $html_type; |
| 72 | |
| 73 | /** |
| 74 | * Use form_options.is_default for field_types which use options. |
| 75 | * |
| 76 | * @var string |
| 77 | */ |
| 78 | public $default_value; |
| 79 | |
| 80 | /** |
| 81 | * Is a value required for this property. |
| 82 | * |
| 83 | * @var boolean |
| 84 | */ |
| 85 | public $is_required; |
| 86 | |
| 87 | /** |
| 88 | * Is this property searchable. |
| 89 | * |
| 90 | * @var boolean |
| 91 | */ |
| 92 | public $is_searchable; |
| 93 | |
| 94 | /** |
| 95 | * Is this property range searchable. |
| 96 | * |
| 97 | * @var boolean |
| 98 | */ |
| 99 | public $is_search_range; |
| 100 | |
| 101 | /** |
| 102 | * Controls field display order within an extended property group. |
| 103 | * |
| 104 | * @var int |
| 105 | */ |
| 106 | public $weight; |
| 107 | |
| 108 | /** |
| 109 | * Description and/or help text to display before this field. |
| 110 | * |
| 111 | * @var text |
| 112 | */ |
| 113 | public $help_pre; |
| 114 | |
| 115 | /** |
| 116 | * Description and/or help text to display after this field. |
| 117 | * |
| 118 | * @var text |
| 119 | */ |
| 120 | public $help_post; |
| 121 | |
| 122 | /** |
| 123 | * Optional format instructions for specific field types, like date types. |
| 124 | * |
| 125 | * @var string |
| 126 | */ |
| 127 | public $mask; |
| 128 | |
| 129 | /** |
| 130 | * Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes |
| 131 | * |
| 132 | * @var string |
| 133 | */ |
| 134 | public $attributes; |
| 135 | |
| 136 | /** |
| 137 | * Optional scripting attributes for field. |
| 138 | * |
| 139 | * @var string |
| 140 | */ |
| 141 | public $javascript; |
| 142 | |
| 143 | /** |
| 144 | * Is this property active? |
| 145 | * |
| 146 | * @var boolean |
| 147 | */ |
| 148 | public $is_active; |
| 149 | |
| 150 | /** |
| 151 | * Is this property set by PHP Code? A code field is viewable but not editable |
| 152 | * |
| 153 | * @var boolean |
| 154 | */ |
| 155 | public $is_view; |
| 156 | |
| 157 | /** |
| 158 | * number of options per line for checkbox and radio |
| 159 | * |
| 160 | * @var int unsigned |
| 161 | */ |
| 162 | public $options_per_line; |
| 163 | |
| 164 | /** |
| 165 | * field length if alphanumeric |
| 166 | * |
| 167 | * @var int unsigned |
| 168 | */ |
| 169 | public $text_length; |
| 170 | |
| 171 | /** |
| 172 | * Date may be up to start_date_years years prior to the current date. |
| 173 | * |
| 174 | * @var int |
| 175 | */ |
| 176 | public $start_date_years; |
| 177 | |
| 178 | /** |
| 179 | * Date may be up to end_date_years years after the current date. |
| 180 | * |
| 181 | * @var int |
| 182 | */ |
| 183 | public $end_date_years; |
| 184 | |
| 185 | /** |
| 186 | * date format for custom date |
| 187 | * |
| 188 | * @var string |
| 189 | */ |
| 190 | public $date_format; |
| 191 | |
| 192 | /** |
| 193 | * time format for custom date |
| 194 | * |
| 195 | * @var int unsigned |
| 196 | */ |
| 197 | public $time_format; |
| 198 | |
| 199 | /** |
| 200 | * Number of columns in Note Field |
| 201 | * |
| 202 | * @var int unsigned |
| 203 | */ |
| 204 | public $note_columns; |
| 205 | |
| 206 | /** |
| 207 | * Number of rows in Note Field |
| 208 | * |
| 209 | * @var int unsigned |
| 210 | */ |
| 211 | public $note_rows; |
| 212 | |
| 213 | /** |
| 214 | * Name of the column that holds the values for this field. |
| 215 | * |
| 216 | * @var string |
| 217 | */ |
| 218 | public $column_name; |
| 219 | |
| 220 | /** |
| 221 | * For elements with options, the option group id that is used |
| 222 | * |
| 223 | * @var int unsigned |
| 224 | */ |
| 225 | public $option_group_id; |
| 226 | |
| 227 | /** |
| 228 | * Stores Contact Get API params contact reference custom fields. May be used for other filters in the future. |
| 229 | * |
| 230 | * @var string |
| 231 | */ |
| 232 | public $filter; |
| 233 | |
| 234 | /** |
| 235 | * Should the multi-record custom field values be displayed in tab table listing |
| 236 | * |
| 237 | * @var boolean |
| 238 | */ |
| 239 | public $in_selector; |
| 240 | |
| 241 | /** |
| 242 | * Class constructor. |
| 243 | */ |
| 244 | public function __construct() { |
| 245 | $this->__table = 'civicrm_custom_field'; |
| 246 | parent::__construct(); |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Returns foreign keys and entity references. |
| 251 | * |
| 252 | * @return array |
| 253 | * [CRM_Core_Reference_Interface] |
| 254 | */ |
| 255 | public static function getReferenceColumns() { |
| 256 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 257 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); |
| 258 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'custom_group_id', 'civicrm_custom_group', 'id'); |
| 259 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'option_group_id', 'civicrm_option_group', 'id'); |
| 260 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 261 | } |
| 262 | return Civi::$statics[__CLASS__]['links']; |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Returns all the column names of this table |
| 267 | * |
| 268 | * @return array |
| 269 | */ |
| 270 | public static function &fields() { |
| 271 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 272 | Civi::$statics[__CLASS__]['fields'] = [ |
| 273 | 'id' => [ |
| 274 | 'name' => 'id', |
| 275 | 'type' => CRM_Utils_Type::T_INT, |
| 276 | 'title' => ts('Custom Field ID'), |
| 277 | 'description' => ts('Unique Custom Field ID'), |
| 278 | 'required' => TRUE, |
| 279 | 'table_name' => 'civicrm_custom_field', |
| 280 | 'entity' => 'CustomField', |
| 281 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 282 | 'localizable' => 0, |
| 283 | ], |
| 284 | 'custom_group_id' => [ |
| 285 | 'name' => 'custom_group_id', |
| 286 | 'type' => CRM_Utils_Type::T_INT, |
| 287 | 'title' => ts('Custom Group'), |
| 288 | 'description' => ts('FK to civicrm_custom_group.'), |
| 289 | 'required' => TRUE, |
| 290 | 'table_name' => 'civicrm_custom_field', |
| 291 | 'entity' => 'CustomField', |
| 292 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 293 | 'localizable' => 0, |
| 294 | 'FKClassName' => 'CRM_Core_DAO_CustomGroup', |
| 295 | 'html' => [ |
| 296 | 'type' => 'Select', |
| 297 | ], |
| 298 | 'pseudoconstant' => [ |
| 299 | 'table' => 'civicrm_custom_group', |
| 300 | 'keyColumn' => 'id', |
| 301 | 'labelColumn' => 'title', |
| 302 | ] |
| 303 | ], |
| 304 | 'name' => [ |
| 305 | 'name' => 'name', |
| 306 | 'type' => CRM_Utils_Type::T_STRING, |
| 307 | 'title' => ts('Custom Field Name'), |
| 308 | 'description' => ts('Variable name/programmatic handle for this group.'), |
| 309 | 'maxlength' => 64, |
| 310 | 'size' => CRM_Utils_Type::BIG, |
| 311 | 'table_name' => 'civicrm_custom_field', |
| 312 | 'entity' => 'CustomField', |
| 313 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 314 | 'localizable' => 0, |
| 315 | ], |
| 316 | 'label' => [ |
| 317 | 'name' => 'label', |
| 318 | 'type' => CRM_Utils_Type::T_STRING, |
| 319 | 'title' => ts('Custom Field Label'), |
| 320 | 'description' => ts('Text for form field label (also friendly name for administering this custom property).'), |
| 321 | 'required' => TRUE, |
| 322 | 'maxlength' => 255, |
| 323 | 'size' => CRM_Utils_Type::HUGE, |
| 324 | 'table_name' => 'civicrm_custom_field', |
| 325 | 'entity' => 'CustomField', |
| 326 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 327 | 'localizable' => 1, |
| 328 | ], |
| 329 | 'data_type' => [ |
| 330 | 'name' => 'data_type', |
| 331 | 'type' => CRM_Utils_Type::T_STRING, |
| 332 | 'title' => ts('Custom Field Data Type'), |
| 333 | 'description' => ts('Controls location of data storage in extended_data table.'), |
| 334 | 'required' => TRUE, |
| 335 | 'maxlength' => 16, |
| 336 | 'size' => CRM_Utils_Type::TWELVE, |
| 337 | 'table_name' => 'civicrm_custom_field', |
| 338 | 'entity' => 'CustomField', |
| 339 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 340 | 'localizable' => 0, |
| 341 | 'html' => [ |
| 342 | 'type' => 'Select', |
| 343 | ], |
| 344 | 'pseudoconstant' => [ |
| 345 | 'callback' => 'CRM_Core_BAO_CustomField::dataType', |
| 346 | ] |
| 347 | ], |
| 348 | 'html_type' => [ |
| 349 | 'name' => 'html_type', |
| 350 | 'type' => CRM_Utils_Type::T_STRING, |
| 351 | 'title' => ts('Custom Field HTML Type'), |
| 352 | 'description' => ts('HTML types plus several built-in extended types.'), |
| 353 | 'required' => TRUE, |
| 354 | 'maxlength' => 32, |
| 355 | 'size' => CRM_Utils_Type::MEDIUM, |
| 356 | 'table_name' => 'civicrm_custom_field', |
| 357 | 'entity' => 'CustomField', |
| 358 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 359 | 'localizable' => 0, |
| 360 | 'pseudoconstant' => [ |
| 361 | 'callback' => 'CRM_Core_SelectValues::customHtmlType', |
| 362 | ] |
| 363 | ], |
| 364 | 'default_value' => [ |
| 365 | 'name' => 'default_value', |
| 366 | 'type' => CRM_Utils_Type::T_STRING, |
| 367 | 'title' => ts('Custom Field Default'), |
| 368 | 'description' => ts('Use form_options.is_default for field_types which use options.'), |
| 369 | 'maxlength' => 255, |
| 370 | 'size' => CRM_Utils_Type::HUGE, |
| 371 | 'table_name' => 'civicrm_custom_field', |
| 372 | 'entity' => 'CustomField', |
| 373 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 374 | 'localizable' => 0, |
| 375 | ], |
| 376 | 'is_required' => [ |
| 377 | 'name' => 'is_required', |
| 378 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 379 | 'title' => ts('Custom Field Is Required?'), |
| 380 | 'description' => ts('Is a value required for this property.'), |
| 381 | 'default' => '0', |
| 382 | 'table_name' => 'civicrm_custom_field', |
| 383 | 'entity' => 'CustomField', |
| 384 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 385 | 'localizable' => 0, |
| 386 | ], |
| 387 | 'is_searchable' => [ |
| 388 | 'name' => 'is_searchable', |
| 389 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 390 | 'title' => ts('Allow Searching on Field?'), |
| 391 | 'description' => ts('Is this property searchable.'), |
| 392 | 'default' => '0', |
| 393 | 'table_name' => 'civicrm_custom_field', |
| 394 | 'entity' => 'CustomField', |
| 395 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 396 | 'localizable' => 0, |
| 397 | ], |
| 398 | 'is_search_range' => [ |
| 399 | 'name' => 'is_search_range', |
| 400 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 401 | 'title' => ts('Search as a Range'), |
| 402 | 'description' => ts('Is this property range searchable.'), |
| 403 | 'default' => '0', |
| 404 | 'table_name' => 'civicrm_custom_field', |
| 405 | 'entity' => 'CustomField', |
| 406 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 407 | 'localizable' => 0, |
| 408 | ], |
| 409 | 'weight' => [ |
| 410 | 'name' => 'weight', |
| 411 | 'type' => CRM_Utils_Type::T_INT, |
| 412 | 'title' => ts('Order'), |
| 413 | 'description' => ts('Controls field display order within an extended property group.'), |
| 414 | 'required' => TRUE, |
| 415 | 'default' => '1', |
| 416 | 'table_name' => 'civicrm_custom_field', |
| 417 | 'entity' => 'CustomField', |
| 418 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 419 | 'localizable' => 0, |
| 420 | ], |
| 421 | 'help_pre' => [ |
| 422 | 'name' => 'help_pre', |
| 423 | 'type' => CRM_Utils_Type::T_TEXT, |
| 424 | 'title' => ts('Custom Field Pre Text'), |
| 425 | 'description' => ts('Description and/or help text to display before this field.'), |
| 426 | 'table_name' => 'civicrm_custom_field', |
| 427 | 'entity' => 'CustomField', |
| 428 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 429 | 'localizable' => 1, |
| 430 | ], |
| 431 | 'help_post' => [ |
| 432 | 'name' => 'help_post', |
| 433 | 'type' => CRM_Utils_Type::T_TEXT, |
| 434 | 'title' => ts('Custom Field Post Text'), |
| 435 | 'description' => ts('Description and/or help text to display after this field.'), |
| 436 | 'table_name' => 'civicrm_custom_field', |
| 437 | 'entity' => 'CustomField', |
| 438 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 439 | 'localizable' => 1, |
| 440 | ], |
| 441 | 'mask' => [ |
| 442 | 'name' => 'mask', |
| 443 | 'type' => CRM_Utils_Type::T_STRING, |
| 444 | 'title' => ts('Custom Field Formatting'), |
| 445 | 'description' => ts('Optional format instructions for specific field types, like date types.'), |
| 446 | 'maxlength' => 64, |
| 447 | 'size' => CRM_Utils_Type::BIG, |
| 448 | 'table_name' => 'civicrm_custom_field', |
| 449 | 'entity' => 'CustomField', |
| 450 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 451 | 'localizable' => 0, |
| 452 | ], |
| 453 | 'attributes' => [ |
| 454 | 'name' => 'attributes', |
| 455 | 'type' => CRM_Utils_Type::T_STRING, |
| 456 | 'title' => ts('Custom Field Attributes'), |
| 457 | 'description' => ts('Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes'), |
| 458 | 'maxlength' => 255, |
| 459 | 'size' => CRM_Utils_Type::HUGE, |
| 460 | 'table_name' => 'civicrm_custom_field', |
| 461 | 'entity' => 'CustomField', |
| 462 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 463 | 'localizable' => 0, |
| 464 | ], |
| 465 | 'javascript' => [ |
| 466 | 'name' => 'javascript', |
| 467 | 'type' => CRM_Utils_Type::T_STRING, |
| 468 | 'title' => ts('Custom Field Javascript'), |
| 469 | 'description' => ts('Optional scripting attributes for field.'), |
| 470 | 'maxlength' => 255, |
| 471 | 'size' => CRM_Utils_Type::HUGE, |
| 472 | 'table_name' => 'civicrm_custom_field', |
| 473 | 'entity' => 'CustomField', |
| 474 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 475 | 'localizable' => 0, |
| 476 | ], |
| 477 | 'is_active' => [ |
| 478 | 'name' => 'is_active', |
| 479 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 480 | 'title' => ts('Custom Field Is Active?'), |
| 481 | 'description' => ts('Is this property active?'), |
| 482 | 'default' => '1', |
| 483 | 'table_name' => 'civicrm_custom_field', |
| 484 | 'entity' => 'CustomField', |
| 485 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 486 | 'localizable' => 0, |
| 487 | ], |
| 488 | 'is_view' => [ |
| 489 | 'name' => 'is_view', |
| 490 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 491 | 'title' => ts('Field is Viewable'), |
| 492 | 'description' => ts('Is this property set by PHP Code? A code field is viewable but not editable'), |
| 493 | 'default' => '0', |
| 494 | 'table_name' => 'civicrm_custom_field', |
| 495 | 'entity' => 'CustomField', |
| 496 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 497 | 'localizable' => 0, |
| 498 | ], |
| 499 | 'options_per_line' => [ |
| 500 | 'name' => 'options_per_line', |
| 501 | 'type' => CRM_Utils_Type::T_INT, |
| 502 | 'title' => ts('Field Options Per Line'), |
| 503 | 'description' => ts('number of options per line for checkbox and radio'), |
| 504 | 'table_name' => 'civicrm_custom_field', |
| 505 | 'entity' => 'CustomField', |
| 506 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 507 | 'localizable' => 0, |
| 508 | ], |
| 509 | 'text_length' => [ |
| 510 | 'name' => 'text_length', |
| 511 | 'type' => CRM_Utils_Type::T_INT, |
| 512 | 'title' => ts('Field Length'), |
| 513 | 'description' => ts('field length if alphanumeric'), |
| 514 | 'table_name' => 'civicrm_custom_field', |
| 515 | 'entity' => 'CustomField', |
| 516 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 517 | 'localizable' => 0, |
| 518 | ], |
| 519 | 'start_date_years' => [ |
| 520 | 'name' => 'start_date_years', |
| 521 | 'type' => CRM_Utils_Type::T_INT, |
| 522 | 'title' => ts('Field Start Date'), |
| 523 | 'description' => ts('Date may be up to start_date_years years prior to the current date.'), |
| 524 | 'table_name' => 'civicrm_custom_field', |
| 525 | 'entity' => 'CustomField', |
| 526 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 527 | 'localizable' => 0, |
| 528 | ], |
| 529 | 'end_date_years' => [ |
| 530 | 'name' => 'end_date_years', |
| 531 | 'type' => CRM_Utils_Type::T_INT, |
| 532 | 'title' => ts('Field End Date'), |
| 533 | 'description' => ts('Date may be up to end_date_years years after the current date.'), |
| 534 | 'table_name' => 'civicrm_custom_field', |
| 535 | 'entity' => 'CustomField', |
| 536 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 537 | 'localizable' => 0, |
| 538 | ], |
| 539 | 'date_format' => [ |
| 540 | 'name' => 'date_format', |
| 541 | 'type' => CRM_Utils_Type::T_STRING, |
| 542 | 'title' => ts('Field Data Format'), |
| 543 | 'description' => ts('date format for custom date'), |
| 544 | 'maxlength' => 64, |
| 545 | 'size' => CRM_Utils_Type::BIG, |
| 546 | 'table_name' => 'civicrm_custom_field', |
| 547 | 'entity' => 'CustomField', |
| 548 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 549 | 'localizable' => 0, |
| 550 | ], |
| 551 | 'time_format' => [ |
| 552 | 'name' => 'time_format', |
| 553 | 'type' => CRM_Utils_Type::T_INT, |
| 554 | 'title' => ts('Field Time Format'), |
| 555 | 'description' => ts('time format for custom date'), |
| 556 | 'table_name' => 'civicrm_custom_field', |
| 557 | 'entity' => 'CustomField', |
| 558 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 559 | 'localizable' => 0, |
| 560 | ], |
| 561 | 'note_columns' => [ |
| 562 | 'name' => 'note_columns', |
| 563 | 'type' => CRM_Utils_Type::T_INT, |
| 564 | 'title' => ts('Field Note Columns'), |
| 565 | 'description' => ts(' Number of columns in Note Field '), |
| 566 | 'table_name' => 'civicrm_custom_field', |
| 567 | 'entity' => 'CustomField', |
| 568 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 569 | 'localizable' => 0, |
| 570 | ], |
| 571 | 'note_rows' => [ |
| 572 | 'name' => 'note_rows', |
| 573 | 'type' => CRM_Utils_Type::T_INT, |
| 574 | 'title' => ts('Field Note Rows'), |
| 575 | 'description' => ts(' Number of rows in Note Field '), |
| 576 | 'table_name' => 'civicrm_custom_field', |
| 577 | 'entity' => 'CustomField', |
| 578 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 579 | 'localizable' => 0, |
| 580 | ], |
| 581 | 'column_name' => [ |
| 582 | 'name' => 'column_name', |
| 583 | 'type' => CRM_Utils_Type::T_STRING, |
| 584 | 'title' => ts('Field Column Name'), |
| 585 | 'description' => ts('Name of the column that holds the values for this field.'), |
| 586 | 'maxlength' => 255, |
| 587 | 'size' => CRM_Utils_Type::HUGE, |
| 588 | 'table_name' => 'civicrm_custom_field', |
| 589 | 'entity' => 'CustomField', |
| 590 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 591 | 'localizable' => 0, |
| 592 | ], |
| 593 | 'option_group_id' => [ |
| 594 | 'name' => 'option_group_id', |
| 595 | 'type' => CRM_Utils_Type::T_INT, |
| 596 | 'title' => ts('Field Option Group'), |
| 597 | 'description' => ts('For elements with options, the option group id that is used'), |
| 598 | 'table_name' => 'civicrm_custom_field', |
| 599 | 'entity' => 'CustomField', |
| 600 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 601 | 'localizable' => 0, |
| 602 | 'FKClassName' => 'CRM_Core_DAO_OptionGroup', |
| 603 | 'pseudoconstant' => [ |
| 604 | 'table' => 'civicrm_option_group', |
| 605 | 'keyColumn' => 'id', |
| 606 | 'labelColumn' => 'title', |
| 607 | ] |
| 608 | ], |
| 609 | 'filter' => [ |
| 610 | 'name' => 'filter', |
| 611 | 'type' => CRM_Utils_Type::T_STRING, |
| 612 | 'title' => ts('Field Filter'), |
| 613 | 'description' => ts('Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.'), |
| 614 | 'maxlength' => 255, |
| 615 | 'size' => CRM_Utils_Type::HUGE, |
| 616 | 'table_name' => 'civicrm_custom_field', |
| 617 | 'entity' => 'CustomField', |
| 618 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 619 | 'localizable' => 0, |
| 620 | ], |
| 621 | 'in_selector' => [ |
| 622 | 'name' => 'in_selector', |
| 623 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 624 | 'title' => ts('Field Display'), |
| 625 | 'description' => ts('Should the multi-record custom field values be displayed in tab table listing'), |
| 626 | 'default' => '0', |
| 627 | 'table_name' => 'civicrm_custom_field', |
| 628 | 'entity' => 'CustomField', |
| 629 | 'bao' => 'CRM_Core_BAO_CustomField', |
| 630 | 'localizable' => 0, |
| 631 | ], |
| 632 | ]; |
| 633 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 634 | } |
| 635 | return Civi::$statics[__CLASS__]['fields']; |
| 636 | } |
| 637 | |
| 638 | /** |
| 639 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 640 | * |
| 641 | * @return array |
| 642 | * Array(string $name => string $uniqueName). |
| 643 | */ |
| 644 | public static function &fieldKeys() { |
| 645 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 646 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 647 | } |
| 648 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 649 | } |
| 650 | |
| 651 | /** |
| 652 | * Returns the names of this table |
| 653 | * |
| 654 | * @return string |
| 655 | */ |
| 656 | public static function getTableName() { |
| 657 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
| 658 | } |
| 659 | |
| 660 | /** |
| 661 | * Returns if this table needs to be logged |
| 662 | * |
| 663 | * @return bool |
| 664 | */ |
| 665 | public function getLog() { |
| 666 | return self::$_log; |
| 667 | } |
| 668 | |
| 669 | /** |
| 670 | * Returns the list of fields that can be imported |
| 671 | * |
| 672 | * @param bool $prefix |
| 673 | * |
| 674 | * @return array |
| 675 | */ |
| 676 | public static function &import($prefix = FALSE) { |
| 677 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_field', $prefix, []); |
| 678 | return $r; |
| 679 | } |
| 680 | |
| 681 | /** |
| 682 | * Returns the list of fields that can be exported |
| 683 | * |
| 684 | * @param bool $prefix |
| 685 | * |
| 686 | * @return array |
| 687 | */ |
| 688 | public static function &export($prefix = FALSE) { |
| 689 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_field', $prefix, []); |
| 690 | return $r; |
| 691 | } |
| 692 | |
| 693 | /** |
| 694 | * Returns the list of indices |
| 695 | * |
| 696 | * @param bool $localize |
| 697 | * |
| 698 | * @return array |
| 699 | */ |
| 700 | public static function indices($localize = TRUE) { |
| 701 | $indices = [ |
| 702 | 'UI_label_custom_group_id' => [ |
| 703 | 'name' => 'UI_label_custom_group_id', |
| 704 | 'field' => [ |
| 705 | 0 => 'label', |
| 706 | 1 => 'custom_group_id', |
| 707 | ], |
| 708 | 'localizable' => TRUE, |
| 709 | 'unique' => TRUE, |
| 710 | 'sig' => 'civicrm_custom_field::1::label::custom_group_id', |
| 711 | ], |
| 712 | 'UI_name_custom_group_id' => [ |
| 713 | 'name' => 'UI_name_custom_group_id', |
| 714 | 'field' => [ |
| 715 | 0 => 'name', |
| 716 | 1 => 'custom_group_id', |
| 717 | ], |
| 718 | 'localizable' => FALSE, |
| 719 | 'unique' => TRUE, |
| 720 | 'sig' => 'civicrm_custom_field::1::name::custom_group_id', |
| 721 | ], |
| 722 | ]; |
| 723 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 724 | } |
| 725 | |
| 726 | } |