5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4129a22b34b4161f5091e01ceaf5a4c1)
13 * Database access object for the UFField entity.
15 class CRM_Core_DAO_UFField
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_uf_field';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
41 * Which form does this field belong to.
48 * Name for CiviCRM field which is being exposed for sharing.
55 * Is this field currently shareable? If false, hide the field for all sharing contexts.
62 * the field is view only and not editable in user forms.
69 * Is this field required when included in a user or registration form?
76 * Controls field display order when user framework fields are displayed in registration and account editing forms.
83 * Description and/or help text to display after this field.
90 * Description and/or help text to display before this field.
97 * In what context(s) is this field visible.
104 * Is this field included as a column in the selector table?
111 * Is this field included search form of profile?
115 public $is_searchable;
118 * Location type of this mapping, if required
122 public $location_type_id;
125 * Phone Type ID, if required
129 public $phone_type_id;
132 * Website Type ID, if required
136 public $website_type_id;
139 * To save label for fields.
146 * This field saves field type (ie individual,household.. field etc).
153 * Is this field reserved for use by some other CiviCRM functionality?
160 * Include in multi-record listing?
164 public $is_multi_summary;
169 public function __construct() {
170 $this->__table
= 'civicrm_uf_field';
171 parent
::__construct();
175 * Returns localized title of this entity.
177 * @param bool $plural
178 * Whether to return the plural version of the title.
180 public static function getEntityTitle($plural = FALSE) {
181 return $plural ?
ts('UFFields') : ts('UFField');
185 * Returns foreign keys and entity references.
188 * [CRM_Core_Reference_Interface]
190 public static function getReferenceColumns() {
191 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
192 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
193 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id');
194 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
195 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
197 return Civi
::$statics[__CLASS__
]['links'];
201 * Returns all the column names of this table
205 public static function &fields() {
206 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
207 Civi
::$statics[__CLASS__
]['fields'] = [
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Profile Field ID'),
212 'description' => ts('Unique table ID'),
214 'where' => 'civicrm_uf_field.id',
215 'table_name' => 'civicrm_uf_field',
216 'entity' => 'UFField',
217 'bao' => 'CRM_Core_BAO_UFField',
226 'name' => 'uf_group_id',
227 'type' => CRM_Utils_Type
::T_INT
,
228 'title' => ts('Profile ID'),
229 'description' => ts('Which form does this field belong to.'),
231 'where' => 'civicrm_uf_field.uf_group_id',
232 'table_name' => 'civicrm_uf_field',
233 'entity' => 'UFField',
234 'bao' => 'CRM_Core_BAO_UFField',
236 'FKClassName' => 'CRM_Core_DAO_UFGroup',
239 'label' => ts("Profile"),
241 'pseudoconstant' => [
242 'table' => 'civicrm_uf_group',
244 'labelColumn' => 'title',
249 'name' => 'field_name',
250 'type' => CRM_Utils_Type
::T_STRING
,
251 'title' => ts('Profile Field Name'),
252 'description' => ts('Name for CiviCRM field which is being exposed for sharing.'),
255 'size' => CRM_Utils_Type
::BIG
,
256 'where' => 'civicrm_uf_field.field_name',
257 'table_name' => 'civicrm_uf_field',
258 'entity' => 'UFField',
259 'bao' => 'CRM_Core_BAO_UFField',
261 'pseudoconstant' => [
262 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
267 'name' => 'is_active',
268 'type' => CRM_Utils_Type
::T_BOOLEAN
,
269 'title' => ts('Profile Field Is Active'),
270 'description' => ts('Is this field currently shareable? If false, hide the field for all sharing contexts.'),
271 'where' => 'civicrm_uf_field.is_active',
273 'table_name' => 'civicrm_uf_field',
274 'entity' => 'UFField',
275 'bao' => 'CRM_Core_BAO_UFField',
281 'type' => CRM_Utils_Type
::T_BOOLEAN
,
282 'title' => ts('Profile Is View Only'),
283 'description' => ts('the field is view only and not editable in user forms.'),
284 'where' => 'civicrm_uf_field.is_view',
286 'table_name' => 'civicrm_uf_field',
287 'entity' => 'UFField',
288 'bao' => 'CRM_Core_BAO_UFField',
293 'name' => 'is_required',
294 'type' => CRM_Utils_Type
::T_BOOLEAN
,
295 'title' => ts('Profile Field Is Required'),
296 'description' => ts('Is this field required when included in a user or registration form?'),
297 'where' => 'civicrm_uf_field.is_required',
299 'table_name' => 'civicrm_uf_field',
300 'entity' => 'UFField',
301 'bao' => 'CRM_Core_BAO_UFField',
307 'type' => CRM_Utils_Type
::T_INT
,
308 'title' => ts('Order'),
309 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
311 'where' => 'civicrm_uf_field.weight',
313 'table_name' => 'civicrm_uf_field',
314 'entity' => 'UFField',
315 'bao' => 'CRM_Core_BAO_UFField',
320 'name' => 'help_post',
321 'type' => CRM_Utils_Type
::T_TEXT
,
322 'title' => ts('Profile Field Post Help'),
323 'description' => ts('Description and/or help text to display after this field.'),
324 'where' => 'civicrm_uf_field.help_post',
325 'table_name' => 'civicrm_uf_field',
326 'entity' => 'UFField',
327 'bao' => 'CRM_Core_BAO_UFField',
332 'name' => 'help_pre',
333 'type' => CRM_Utils_Type
::T_TEXT
,
334 'title' => ts('Profile Field Pre Help'),
335 'description' => ts('Description and/or help text to display before this field.'),
336 'where' => 'civicrm_uf_field.help_pre',
337 'table_name' => 'civicrm_uf_field',
338 'entity' => 'UFField',
339 'bao' => 'CRM_Core_BAO_UFField',
344 'name' => 'visibility',
345 'type' => CRM_Utils_Type
::T_STRING
,
346 'title' => ts('Profile Field Visibility'),
347 'description' => ts('In what context(s) is this field visible.'),
349 'size' => CRM_Utils_Type
::MEDIUM
,
350 'where' => 'civicrm_uf_field.visibility',
351 'default' => 'User and User Admin Only',
352 'table_name' => 'civicrm_uf_field',
353 'entity' => 'UFField',
354 'bao' => 'CRM_Core_BAO_UFField',
359 'pseudoconstant' => [
360 'callback' => 'CRM_Core_SelectValues::ufVisibility',
365 'name' => 'in_selector',
366 'type' => CRM_Utils_Type
::T_BOOLEAN
,
367 'title' => ts('Profile Field Is a Filter'),
368 'description' => ts('Is this field included as a column in the selector table?'),
369 'where' => 'civicrm_uf_field.in_selector',
371 'table_name' => 'civicrm_uf_field',
372 'entity' => 'UFField',
373 'bao' => 'CRM_Core_BAO_UFField',
378 'name' => 'is_searchable',
379 'type' => CRM_Utils_Type
::T_BOOLEAN
,
380 'title' => ts('Profile Field Is Searchable'),
381 'description' => ts('Is this field included search form of profile?'),
382 'where' => 'civicrm_uf_field.is_searchable',
384 'table_name' => 'civicrm_uf_field',
385 'entity' => 'UFField',
386 'bao' => 'CRM_Core_BAO_UFField',
390 'location_type_id' => [
391 'name' => 'location_type_id',
392 'type' => CRM_Utils_Type
::T_INT
,
393 'title' => ts('Location Type ID'),
394 'description' => ts('Location type of this mapping, if required'),
395 'where' => 'civicrm_uf_field.location_type_id',
396 'table_name' => 'civicrm_uf_field',
397 'entity' => 'UFField',
398 'bao' => 'CRM_Core_BAO_UFField',
400 'FKClassName' => 'CRM_Core_DAO_LocationType',
402 'label' => ts("Location Type"),
407 'name' => 'phone_type_id',
408 'type' => CRM_Utils_Type
::T_INT
,
409 'title' => ts('Profile Field Phone Type'),
410 'description' => ts('Phone Type ID, if required'),
411 'where' => 'civicrm_uf_field.phone_type_id',
412 'table_name' => 'civicrm_uf_field',
413 'entity' => 'UFField',
414 'bao' => 'CRM_Core_BAO_UFField',
416 'pseudoconstant' => [
417 'optionGroupName' => 'phone_type',
418 'optionEditPath' => 'civicrm/admin/options/phone_type',
422 'website_type_id' => [
423 'name' => 'website_type_id',
424 'type' => CRM_Utils_Type
::T_INT
,
425 'title' => ts('Profile Field Website Type'),
426 'description' => ts('Website Type ID, if required'),
427 'where' => 'civicrm_uf_field.website_type_id',
428 'table_name' => 'civicrm_uf_field',
429 'entity' => 'UFField',
430 'bao' => 'CRM_Core_BAO_UFField',
432 'pseudoconstant' => [
433 'optionGroupName' => 'website_type',
434 'optionEditPath' => 'civicrm/admin/options/website_type',
440 'type' => CRM_Utils_Type
::T_STRING
,
441 'title' => ts('Profile Field Label'),
442 'description' => ts('To save label for fields.'),
445 'size' => CRM_Utils_Type
::HUGE
,
446 'where' => 'civicrm_uf_field.label',
447 'table_name' => 'civicrm_uf_field',
448 'entity' => 'UFField',
449 'bao' => 'CRM_Core_BAO_UFField',
454 'name' => 'field_type',
455 'type' => CRM_Utils_Type
::T_STRING
,
456 'title' => ts('Profile Field Type'),
457 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
459 'size' => CRM_Utils_Type
::HUGE
,
460 'where' => 'civicrm_uf_field.field_type',
461 'table_name' => 'civicrm_uf_field',
462 'entity' => 'UFField',
463 'bao' => 'CRM_Core_BAO_UFField',
468 'name' => 'is_reserved',
469 'type' => CRM_Utils_Type
::T_BOOLEAN
,
470 'title' => ts('Profile Field Is Reserved'),
471 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
472 'where' => 'civicrm_uf_field.is_reserved',
473 'table_name' => 'civicrm_uf_field',
474 'entity' => 'UFField',
475 'bao' => 'CRM_Core_BAO_UFField',
479 'is_multi_summary' => [
480 'name' => 'is_multi_summary',
481 'type' => CRM_Utils_Type
::T_BOOLEAN
,
482 'title' => ts('Profile Field Supports Multiple'),
483 'description' => ts('Include in multi-record listing?'),
484 'where' => 'civicrm_uf_field.is_multi_summary',
486 'table_name' => 'civicrm_uf_field',
487 'entity' => 'UFField',
488 'bao' => 'CRM_Core_BAO_UFField',
493 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
495 return Civi
::$statics[__CLASS__
]['fields'];
499 * Return a mapping from field-name to the corresponding key (as used in fields()).
502 * Array(string $name => string $uniqueName).
504 public static function &fieldKeys() {
505 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
506 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
508 return Civi
::$statics[__CLASS__
]['fieldKeys'];
512 * Returns the names of this table
516 public static function getTableName() {
517 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
521 * Returns if this table needs to be logged
525 public function getLog() {
530 * Returns the list of fields that can be imported
532 * @param bool $prefix
536 public static function &import($prefix = FALSE) {
537 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'uf_field', $prefix, []);
542 * Returns the list of fields that can be exported
544 * @param bool $prefix
548 public static function &export($prefix = FALSE) {
549 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'uf_field', $prefix, []);
554 * Returns the list of indices
556 * @param bool $localize
560 public static function indices($localize = TRUE) {
562 'IX_website_type_id' => [
563 'name' => 'IX_website_type_id',
565 0 => 'website_type_id',
567 'localizable' => FALSE,
568 'sig' => 'civicrm_uf_field::0::website_type_id',
571 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;