3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * One place to store frequently used values in Select Elements. Note that
14 * some of the below elements will be dynamic, so we'll probably have a
15 * smart caching scheme on a per domain basis
18 * @copyright CiviCRM LLC https://civicrm.org/licensing
20 class CRM_Core_SelectValues
{
27 public static function boolean() {
35 * Preferred mail format.
39 public static function pmf() {
52 public static function privacy() {
54 'do_not_phone' => ts('Do not phone'),
55 'do_not_email' => ts('Do not email'),
56 'do_not_mail' => ts('Do not mail'),
57 'do_not_sms' => ts('Do not sms'),
58 'do_not_trade' => ts('Do not trade'),
59 'is_opt_out' => ts('No bulk emails (User Opt Out)'),
64 * Various pre defined contact super types.
68 public static function contactType() {
69 return CRM_Contact_BAO_ContactType
::basicTypePairs();
73 * Various pre defined unit list.
75 * @param string $unitType
78 public static function unitList($unitType = NULL) {
81 'month' => ts('month'),
84 if ($unitType === 'duration') {
85 $unitList['lifetime'] = ts('lifetime');
91 * Membership type unit.
95 public static function membershipTypeUnitList() {
96 return self
::unitList('duration');
100 * Various pre defined period types.
104 public static function periodType() {
106 'rolling' => ts('Rolling'),
107 'fixed' => ts('Fixed'),
112 * Various pre defined email selection methods.
116 public static function emailSelectMethods() {
118 'automatic' => ts('Automatic'),
119 'location-only' => ts('Only send to email addresses assigned to the specified location'),
120 'location-prefer' => ts('Prefer email addresses assigned to the specified location'),
121 'location-exclude' => ts('Exclude email addresses assigned to the specified location'),
126 * Various pre defined member visibility options.
130 public static function memberVisibility() {
132 'Public' => ts('Public'),
133 'Admin' => ts('Admin'),
138 * Member auto-renew options
142 public static function memberAutoRenew() {
144 ts('No auto-renew option'),
145 ts('Give option, but not required'),
146 ts('Auto-renew required'),
151 * Various pre defined event dates.
155 public static function eventDate() {
157 'start_date' => ts('start date'),
158 'end_date' => ts('end date'),
159 'join_date' => ts('member since'),
164 * Custom form field types.
168 public static function customHtmlType() {
170 'Text' => ts('Single-line input field (text or numeric)'),
171 'TextArea' => ts('Multi-line text box (textarea)'),
172 'Select' => ts('Drop-down (select list)'),
173 'Radio' => ts('Radio buttons'),
174 'CheckBox' => ts('Checkbox(es)'),
175 'Select Date' => ts('Select Date'),
176 'File' => ts('File'),
177 'RichTextEditor' => ts('Rich Text Editor'),
178 'Autocomplete-Select' => ts('Autocomplete-Select'),
179 'Link' => ts('Link'),
184 * Various pre defined extensions for dynamic properties and groups.
189 public static function customGroupExtends() {
190 $customGroupExtends = [
191 'Activity' => ts('Activities'),
192 'Relationship' => ts('Relationships'),
193 'Contribution' => ts('Contributions'),
194 'ContributionRecur' => ts('Recurring Contributions'),
195 'Group' => ts('Groups'),
196 'Membership' => ts('Memberships'),
197 'Event' => ts('Events'),
198 'Participant' => ts('Participants'),
199 'ParticipantRole' => ts('Participants (Role)'),
200 'ParticipantEventName' => ts('Participants (Event Name)'),
201 'ParticipantEventType' => ts('Participants (Event Type)'),
202 'Pledge' => ts('Pledges'),
203 'Grant' => ts('Grants'),
204 'Address' => ts('Addresses'),
205 'Campaign' => ts('Campaigns'),
207 $contactTypes = ['Contact' => ts('Contacts')] + self
::contactType();
208 $extendObjs = CRM_Core_OptionGroup
::values('cg_extend_objects');
209 $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs);
210 return $customGroupExtends;
214 * Styles for displaying the custom data group.
218 public static function customGroupStyle() {
221 'Inline' => ts('Inline'),
222 'Tab with table' => ts('Tab with table'),
227 * For displaying the uf group types.
231 public static function ufGroupTypes() {
233 'Profile' => ts('Standalone Form or Directory'),
234 'Search Profile' => ts('Search Views'),
237 if (CRM_Core_Config
::singleton()->userSystem
->supports_form_extensions
) {
239 'User Registration' => ts('Drupal User Registration'),
240 'User Account' => ts('View/Edit Drupal User Account'),
247 * The status of a contact within a group.
251 public static function groupContactStatus() {
253 'Added' => ts('Added'),
254 'Removed' => ts('Removed'),
255 'Pending' => ts('Pending'),
260 * List of Group Types.
264 public static function groupType() {
266 'query' => ts('Dynamic'),
267 'static' => ts('Static'),
272 * Compose the parameters for a date select object.
274 * @param string|null $type
276 * @param string|null $format
277 * date format (QF format)
278 * @param null $minOffset
279 * @param null $maxOffset
280 * @param string $context
284 * @throws CRM_Core_Exception
286 public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') {
287 // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime.
289 'addEmptyOption' => TRUE,
290 'emptyOptionText' => ts('- select -'),
291 'emptyOptionValue' => '',
295 $date['format'] = $format;
299 $dao = new CRM_Core_DAO_PreferencesDate();
301 if (!$dao->find(TRUE)) {
302 throw new CRM_Core_Exception('Date preferences not configured.');
305 $maxOffset = $dao->end
;
308 $minOffset = $dao->start
;
311 $date['format'] = $dao->date_format
;
312 $date['time'] = (bool) $dao->time_format
;
315 if (empty($date['format'])) {
316 if ($context === 'Input') {
317 $date['format'] = Civi
::settings()->get('dateInputFormat');
320 $date['format'] = 'M d';
325 $date['smarty_view_format'] = CRM_Utils_Date
::getDateFieldViewFormat($date['format']);
326 if (!isset($date['time'])) {
327 $date['time'] = FALSE;
331 $date['minYear'] = $year - (int) $minOffset;
332 $date['maxYear'] = $year +
(int) $maxOffset;
337 * Values for UF form visibility options.
341 public static function ufVisibility() {
343 'User and User Admin Only' => ts('User and User Admin Only'),
344 'Public Pages' => ts('Expose Publicly'),
345 'Public Pages and Listings' => ts('Expose Publicly and for Listings'),
350 * Values for group form visibility options.
354 public static function groupVisibility() {
356 'User and User Admin Only' => ts('User and User Admin Only'),
357 'Public Pages' => ts('Public Pages'),
362 * Different type of Mailing Components.
366 public static function mailingComponents() {
368 'Header' => ts('Header'),
369 'Footer' => ts('Footer'),
370 'Reply' => ts('Reply Auto-responder'),
371 'OptOut' => ts('Opt-out Message'),
372 'Subscribe' => ts('Subscription Confirmation Request'),
373 'Welcome' => ts('Welcome Message'),
374 'Unsubscribe' => ts('Unsubscribe Message'),
375 'Resubscribe' => ts('Resubscribe Message'),
384 public function getHours() {
386 for ($i = 0; $i <= 6; $i++
) {
397 public function getMinutes() {
399 for ($i = 0; $i < 60; $i = $i +
15) {
406 * Get the Map Provider.
409 * array of map providers
411 public static function mapProvider() {
414 $map = ['' => '- select -'] + CRM_Utils_System
::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
420 * Get the Geocoding Providers from available plugins.
423 * array of geocoder providers
425 public static function geoProvider() {
428 $geo = ['' => '- select -'] + CRM_Utils_System
::getPluginList('CRM/Utils/Geocode');
434 * Get options for displaying tax.
438 * @throws \CRM_Core_Exception
440 public static function taxDisplayOptions() {
442 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [
443 1 => CRM_Utils_Money
::format(120),
445 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [
446 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
448 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [
449 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
455 * Get the Address Standardization Providers from available plugins.
458 * array of address standardization providers
460 public static function addressProvider() {
463 $addr = array_merge(['' => '- select -'], CRM_Utils_System
::getPluginList('CRM/Utils/Address', '.php', ['BatchUpdate']));
469 * Different type of Mailing Tokens.
473 public static function mailingTokens() {
475 '{action.unsubscribe}' => ts('Unsubscribe via email'),
476 '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
477 '{action.resubscribe}' => ts('Resubscribe via email'),
478 '{action.resubscribeUrl}' => ts('Resubscribe via web page'),
479 '{action.optOut}' => ts('Opt out via email'),
480 '{action.optOutUrl}' => ts('Opt out via web page'),
481 '{action.forward}' => ts('Forward this email (link)'),
482 '{action.reply}' => ts('Reply to this email (link)'),
483 '{action.subscribeUrl}' => ts('Subscribe via web page'),
484 '{mailing.key}' => ts('Mailing key'),
485 '{mailing.name}' => ts('Mailing name'),
486 '{mailing.group}' => ts('Mailing group'),
487 '{mailing.viewUrl}' => ts('Mailing permalink'),
488 ] + self
::domainTokens();
496 public static function domainTokens() {
498 '{domain.name}' => ts('Domain name'),
499 '{domain.address}' => ts('Domain (organization) address'),
500 '{domain.phone}' => ts('Domain (organization) phone'),
501 '{domain.email}' => ts('Domain (organization) email'),
506 * Different type of Activity Tokens.
510 public static function activityTokens() {
512 '{activity.activity_id}' => ts('Activity ID'),
513 '{activity.subject}' => ts('Activity Subject'),
514 '{activity.details}' => ts('Activity Details'),
515 '{activity.activity_date_time}' => ts('Activity Date Time'),
520 * Different type of Membership Tokens.
524 public static function membershipTokens() {
526 '{membership.id}' => ts('Membership ID'),
527 '{membership.status}' => ts('Membership Status'),
528 '{membership.type}' => ts('Membership Type'),
529 '{membership.start_date}' => ts('Membership Start Date'),
530 '{membership.join_date}' => ts('Membership Join Date'),
531 '{membership.end_date}' => ts('Membership End Date'),
532 '{membership.fee}' => ts('Membership Fee'),
537 * Different type of Event Tokens.
541 public static function eventTokens() {
543 '{event.event_id}' => ts('Event ID'),
544 '{event.title}' => ts('Event Title'),
545 '{event.start_date}' => ts('Event Start Date'),
546 '{event.end_date}' => ts('Event End Date'),
547 '{event.event_type}' => ts('Event Type'),
548 '{event.summary}' => ts('Event Summary'),
549 '{event.contact_email}' => ts('Event Contact Email'),
550 '{event.contact_phone}' => ts('Event Contact Phone'),
551 '{event.description}' => ts('Event Description'),
552 '{event.location}' => ts('Event Location'),
553 '{event.fee_amount}' => ts('Event Fees'),
554 '{event.info_url}' => ts('Event Info URL'),
555 '{event.registration_url}' => ts('Event Registration URL'),
556 '{event.balance}' => ts('Event Balance'),
561 * Different type of Event Tokens.
565 public static function contributionTokens(): array {
567 $processor = new CRM_Contribute_Tokens();
568 foreach ($processor->getAllTokens() as $token => $title) {
569 $tokens['{contribution.' . $token . '}'] = $title;
575 * Different type of Contact Tokens.
579 public static function contactTokens() {
580 static $tokens = NULL;
582 $additionalFields = [
583 'checksum' => ['title' => ts('Checksum')],
584 'contact_id' => ['title' => ts('Internal Contact ID')],
586 $exportFields = array_merge(CRM_Contact_BAO_Contact
::exportableFields(), $additionalFields);
588 $values = array_merge(array_keys($exportFields));
591 //FIXME:skipping some tokens for time being.
605 'postal_greeting_id',
608 $customFields = CRM_Core_BAO_CustomField
::getFields(['Individual', 'Address']);
609 $legacyTokenNames = array_flip(CRM_Utils_Token
::legacyContactTokens());
611 foreach ($values as $val) {
612 if (in_array($val, $skipTokens)) {
615 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
616 $customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val);
617 if ($customFieldId) {
618 // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
619 if (!empty($customFields[$customFieldId])) {
620 $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
624 // Support legacy token names
625 $tokenName = CRM_Utils_Array
::value($val, $legacyTokenNames, $val);
626 $tokens["{contact.$tokenName}"] = $exportFields[$val]['title'];
630 // Get all the hook tokens too
632 CRM_Utils_Hook
::tokens($hookTokens);
633 foreach ($hookTokens as $tokenValues) {
634 foreach ($tokenValues as $key => $value) {
635 if (is_numeric($key)) {
638 if (!preg_match('/^\{[^\}]+\}$/', $key)) {
639 $key = '{' . $key . '}';
641 if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) {
642 $value = $matches[1];
644 $tokens[$key] = $value;
653 * Different type of Participant Tokens.
657 public static function participantTokens() {
658 static $tokens = NULL;
660 $exportFields = CRM_Event_BAO_Participant
::exportableFields();
662 $values = array_merge(array_keys($exportFields));
665 // skipping some tokens for time being.
668 'participant_is_pay_later',
669 'participant_is_test',
670 'participant_contact_id',
671 'participant_fee_currency',
672 'participant_campaign_id',
673 'participant_status',
674 'participant_discount_name',
677 $customFields = CRM_Core_BAO_CustomField
::getFields('Participant');
679 foreach ($values as $key => $val) {
680 if (in_array($val, $skipTokens)) {
683 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
684 if ($customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val)) {
685 $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ?
$customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
688 $tokens["{participant.$val}"] = $exportFields[$val]['title'];
696 * @param int $caseTypeId
699 public static function caseTokens($caseTypeId = NULL) {
700 static $tokens = NULL;
702 foreach (CRM_Case_BAO_Case
::fields() as $field) {
703 $tokens["{case.{$field['name']}}"] = $field['title'];
706 $customFields = CRM_Core_BAO_CustomField
::getFields('Case', FALSE, FALSE, $caseTypeId);
707 foreach ($customFields as $id => $field) {
708 $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}";
715 * CiviCRM supported date input formats.
719 public static function getDatePluginInputFormats() {
721 'mm/dd/yy' => ts('mm/dd/yy (12/31/2009)'),
722 'dd/mm/yy' => ts('dd/mm/yy (31/12/2009)'),
723 'yy-mm-dd' => ts('yy-mm-dd (2009-12-31)'),
724 'dd-mm-yy' => ts('dd-mm-yy (31-12-2009)'),
725 'dd.mm.yy' => ts('dd.mm.yy (31.12.2009)'),
726 'M d, yy' => ts('M d, yy (Dec 31, 2009)'),
727 'd M yy' => ts('d M yy (31 Dec 2009)'),
728 'MM d, yy' => ts('MM d, yy (December 31, 2009)'),
729 'd MM yy' => ts('d MM yy (31 December 2009)'),
730 'DD, d MM yy' => ts('DD, d MM yy (Thursday, 31 December 2009)'),
731 'mm/dd' => ts('mm/dd (12/31)'),
732 'dd-mm' => ts('dd-mm (31-12)'),
733 'yy-mm' => ts('yy-mm (2009-12)'),
734 'M yy' => ts('M yy (Dec 2009)'),
735 'yy' => ts('yy (2009)'),
744 public static function getTimeFormats() {
746 '1' => ts('12 Hours'),
747 '2' => ts('24 Hours'),
752 * Get numeric options.
759 public static function getNumericOptions($start = 0, $end = 10) {
760 $numericOptions = [];
761 for ($i = $start; $i <= $end; $i++
) {
762 $numericOptions[$i] = $i;
764 return $numericOptions;
772 public static function getBarcodeTypes() {
774 'barcode' => ts('Linear (1D)'),
775 'qrcode' => ts('QR code'),
784 public static function getDedupeRuleTypes() {
786 'Unsupervised' => ts('Unsupervised'),
787 'Supervised' => ts('Supervised'),
788 'General' => ts('General'),
793 * Campaign group types.
797 public static function getCampaignGroupTypes() {
799 'Include' => ts('Include'),
800 'Exclude' => ts('Exclude'),
805 * Subscription history method.
809 public static function getSubscriptionHistoryMethods() {
811 'Admin' => ts('Admin'),
812 'Email' => ts('Email'),
823 public static function getPremiumUnits() {
826 'week' => ts('Week'),
827 'month' => ts('Month'),
828 'year' => ts('Year'),
837 public static function getExtensionTypes() {
839 'payment' => ts('Payment'),
840 'search' => ts('Search'),
841 'report' => ts('Report'),
842 'module' => ts('Module'),
852 public static function getJobFrequency() {
855 'Yearly' => ts('Yearly'),
856 'Quarter' => ts('Quarterly'),
857 'Monthly' => ts('Monthly'),
858 'Weekly' => ts('Weekly'),
860 'Daily' => ts('Daily'),
861 'Hourly' => ts('Hourly'),
862 'Always' => ts('Every time cron job is run'),
867 * Search builder operators.
871 public static function getSearchBuilderOperators() {
880 'NOT IN' => ts('Not In'),
881 'LIKE' => ts('Like'),
882 'NOT LIKE' => ts('Not Like'),
883 'RLIKE' => ts('Regex'),
884 'IS EMPTY' => ts('Is Empty'),
885 'IS NOT EMPTY' => ts('Not Empty'),
886 'IS NULL' => ts('Is Null'),
887 'IS NOT NULL' => ts('Not Null'),
892 * Profile group types.
896 public static function getProfileGroupType() {
897 $profileGroupType = [
898 'Activity' => ts('Activities'),
899 'Contribution' => ts('Contributions'),
900 'Membership' => ts('Memberships'),
901 'Participant' => ts('Participants'),
903 $contactTypes = self
::contactType();
904 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
905 $profileGroupType = array_merge($contactTypes, $profileGroupType);
907 return $profileGroupType;
911 * Word replacement match type.
915 public static function getWordReplacementMatchType() {
917 'exactMatch' => ts('Exact Match'),
918 'wildcardMatch' => ts('Wildcard Match'),
923 * Mailing group types.
927 public static function getMailingGroupTypes() {
929 'Include' => ts('Include'),
930 'Exclude' => ts('Exclude'),
931 'Base' => ts('Base'),
936 * Mailing Job Status.
940 public static function getMailingJobStatus() {
942 'Scheduled' => ts('Scheduled'),
943 'Running' => ts('Running'),
944 'Complete' => ts('Complete'),
945 'Paused' => ts('Paused'),
946 'Canceled' => ts('Canceled'),
953 public static function billingMode() {
955 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'form',
956 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'button',
957 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
964 public static function contributeMode() {
966 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'direct',
967 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'directIPN',
968 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
973 * Frequency unit for schedule reminders.
979 public static function getRecurringFrequencyUnits($count = 1) {
980 // @todo this used to refer to the 'recur_frequency_unit' option_values which
981 // is for recurring payments and probably not good to re-use for recurring entities.
982 // If something other than a hard-coded list is desired, add a new option_group.
984 'hour' => ts('hour', ['plural' => 'hours', 'count' => $count]),
985 'day' => ts('day', ['plural' => 'days', 'count' => $count]),
986 'week' => ts('week', ['plural' => 'weeks', 'count' => $count]),
987 'month' => ts('month', ['plural' => 'months', 'count' => $count]),
988 'year' => ts('year', ['plural' => 'years', 'count' => $count]),
993 * Relative Date Terms.
997 public static function getRelativeDateTerms() {
999 'previous' => ts('Previous'),
1000 'previous_2' => ts('Previous 2'),
1001 'previous_before' => ts('Prior to Previous'),
1002 'before_previous' => ts('All Prior to Previous'),
1003 'earlier' => ts('To End of Previous'),
1004 'greater_previous' => ts('From End of Previous'),
1005 'greater' => ts('From Start Of Current'),
1006 'current' => ts('Current'),
1007 'ending_3' => ts('Last 3'),
1008 'ending_2' => ts('Last 2'),
1009 'ending' => ts('Last'),
1010 'this' => ts('This'),
1011 'starting' => ts('Upcoming'),
1012 'less' => ts('To End of'),
1013 'next' => ts('Next'),
1018 * Relative Date Units.
1022 public static function getRelativeDateUnits() {
1024 'year' => ts('Years'),
1025 'fiscal_year' => ts('Fiscal Years'),
1026 'quarter' => ts('Quarters'),
1027 'month' => ts('Months'),
1028 'week' => ts('Weeks'),
1029 'day' => ts('Days'),
1034 * Exportable document formats.
1038 public static function documentFormat() {
1040 'pdf' => ts('Portable Document Format (.pdf)'),
1041 'docx' => ts('MS Word (.docx)'),
1042 'odt' => ts('Open Office (.odt)'),
1043 'html' => ts('Webpage (.html)'),
1048 * Application type of document.
1052 public static function documentApplicationType() {
1054 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1055 'odt' => 'application/vnd.oasis.opendocument.text',
1060 * Activity Text options.
1064 public static function activityTextOptions() {
1066 2 => ts('Details Only'),
1067 3 => ts('Subject Only'),
1073 * Relationship permissions
1077 public static function getPermissionedRelationshipOptions() {
1079 CRM_Contact_BAO_Relationship
::NONE
=> ts('None'),
1080 CRM_Contact_BAO_Relationship
::VIEW
=> ts('View only'),
1081 CRM_Contact_BAO_Relationship
::EDIT
=> ts('View and update'),
1086 * Get option values for dashboard entries (used for 'how many events to display on dashboard').
1089 * Dashboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100].
1091 public static function getDashboardEntriesCount() {
1093 $optionValues[-1] = ts('show all');
1094 for ($i = 10; $i <= 100; $i +
= 10) {
1095 $optionValues[$i] = $i;
1097 return $optionValues;
1101 * Dropdown options for quicksearch in the menu
1104 * @throws \CiviCRM_API3_Exception
1106 public static function quicksearchOptions() {
1107 $includeEmail = civicrm_api3('setting', 'getvalue', ['name' => 'includeEmailInName', 'group' => 'Search Preferences']);
1109 'sort_name' => $includeEmail ?
ts('Name/Email') : ts('Name'),
1110 'contact_id' => ts('Contact ID'),
1111 'external_identifier' => ts('External ID'),
1112 'first_name' => ts('First Name'),
1113 'last_name' => ts('Last Name'),
1114 'email' => ts('Email'),
1115 'phone_numeric' => ts('Phone'),
1116 'street_address' => ts('Street Address'),
1117 'city' => ts('City'),
1118 'postal_code' => ts('Postal Code'),
1119 'job_title' => ts('Job Title'),
1121 $custom = civicrm_api3('CustomField', 'get', [
1122 'return' => ['name', 'label', 'custom_group_id.title'],
1123 'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
1124 'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
1125 'custom_group_id.is_active' => 1,
1127 'is_searchable' => 1,
1128 'options' => ['sort' => ['custom_group_id.weight', 'weight'], 'limit' => 0],
1130 foreach ($custom['values'] as $field) {
1131 $options['custom_' . $field['name']] = $field['custom_group_id.title'] . ': ' . $field['label'];
1137 * Get components (translated for display.
1141 * @throws \Exception
1143 public static function getComponentSelectValues() {
1145 $components = CRM_Core_Component
::getComponents();
1146 foreach ($components as $name => $object) {
1147 $ret[$name] = $object->info
['translatedName'];
1156 public static function fieldSerialization() {
1158 CRM_Core_DAO
::SERIALIZE_SEPARATOR_BOOKEND
=> 'separator_bookend',
1159 CRM_Core_DAO
::SERIALIZE_SEPARATOR_TRIMMED
=> 'separator_trimmed',
1160 CRM_Core_DAO
::SERIALIZE_JSON
=> 'json',
1161 CRM_Core_DAO
::SERIALIZE_PHP
=> 'php',
1162 CRM_Core_DAO
::SERIALIZE_COMMA
=> 'comma',
1169 public static function navigationMenuSeparator() {
1172 ts('After menu element'),
1173 ts('Before menu element'),
1180 public static function relationshipOrientation() {
1182 'a_b' => ts('A to B'),
1183 'b_a' => ts('B to A'),