Merge pull request #18221 from civicrm/eileenmcnaughton-patch-1
[civicrm-core.git] / CRM / UF / Form / AdvanceSetting.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 class CRM_UF_Form_AdvanceSetting extends CRM_UF_Form_Group {
18
19 /**
20 * Build the form object for Advanced Settings.
21 *
22 * @param CRM_Core_Form $form
23 */
24 public static function buildAdvanceSetting(&$form) {
25 $entityFields = [
26 'cancel_button_text',
27 'submit_button_text',
28 ];
29 $form->assign('advancedFieldsConverted', $entityFields);
30
31 // should mapping be enabled for this group
32 $form->addElement('checkbox', 'is_map', ts('Enable mapping for this profile?'));
33
34 // should we allow updates on a exisitng contact
35 $form->addRadio('is_update_dupe', ts('What to do upon duplicate match'), [ts('Issue warning and do not save'), ts('Update the matching contact'), ts('Allow duplicate contact to be created')]);
36 // we do not have any url checks to allow relative urls
37 $form->addElement('text', 'post_URL', ts('Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'post_URL'));
38
39 $form->add('advcheckbox', 'add_cancel_button', ts('Include Cancel Button?'));
40 $form->addElement('text', 'cancel_URL', ts('Cancel Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'cancel_URL'));
41
42 // add select for groups
43 $group = ['' => ts('- select -')] + $form->_group;
44 $form->_groupElement = &$form->addElement('select', 'group', ts('Limit listings to a specific Group?'), $group);
45
46 //add notify field
47 $form->addElement('text', 'notify', ts('Notify when profile form is submitted?'));
48
49 //group where new contacts are directed.
50 $form->addElement('select', 'add_contact_to_group', ts('Add new contacts to a Group?'), $group);
51
52 // add CAPTCHA To this group ?
53 $form->addElement('checkbox', 'add_captcha', ts('Include reCAPTCHA?'));
54
55 // should we display an edit link
56 $form->addElement('checkbox', 'is_edit_link', ts('Include profile edit links in search results?'));
57
58 // should we display a link to the website profile
59 $config = CRM_Core_Config::singleton();
60 $form->addElement('checkbox', 'is_uf_link', ts('Include %1 user account information links in search results?', [1 => $config->userFramework]));
61
62 // want to create cms user
63 $session = CRM_Core_Session::singleton();
64 $cmsId = FALSE;
65 if ($form->_cId = $session->get('userID')) {
66 $form->_cmsId = TRUE;
67 }
68
69 $form->addRadio('is_cms_user', ts('%1 user account registration option?', [1 => $config->userFramework]), [ts('No account create option'), ts('Give option, but not required'), ts('Account creation required')]);
70
71 // options for including Proximity Search in the profile search form
72 $form->addRadio('is_proximity_search', ts('Proximity Search'), [ts('None'), ts('Optional'), ts('Required')]);
73 }
74
75 }