private function AdminForm::buildOptionsTab in Webform CiviCRM Integration 8.5
Configure additional options
1 call to AdminForm::buildOptionsTab()
- AdminForm::buildForm in src/
AdminForm.php - Build admin form for civicrm tab of a webform
File
- src/
AdminForm.php, line 1338 - Webform CiviCRM module's admin form.
Class
- AdminForm
- @file Webform CiviCRM module's admin form.
Namespace
Drupal\webform_civicrmCode
private function buildOptionsTab() {
$utils = \Drupal::service('webform_civicrm.utils');
$this->form['additional_options'] = [
'#type' => 'details',
'#group' => 'webform_civicrm',
'#title' => t('Additional Settings'),
'#attributes' => [
'class' => [
'civi-icon-prefs',
],
],
];
$this->form['additional_options']['checksum_text'] = [
'#type' => 'item',
'#markup' => '<p>' . t('To have this form auto-filled for anonymous users, enable the "Existing Contact" field for :contact and send the following link from CiviMail:', [
':contact' => $utils
->wf_crm_contact_label(1, $this->data, 'escape'),
]) . '<br /><pre>' . Url::fromRoute('entity.webform.canonical', [
'webform' => $this->webform
->id(),
], [
'query' => [
'cid1' => '',
],
'absolute' => TRUE,
])
->toString() . '{contact.contact_id}&{contact.checksum}</pre></p>',
];
$this->form['additional_options']['create_fieldsets'] = [
'#type' => 'checkbox',
'#title' => t('Create Fieldsets'),
'#default_value' => (bool) $this->settings['create_fieldsets'],
'#description' => t('Create a fieldset around each contact, activity, etc. Provides visual organization of your form.'),
];
$this->form['additional_options']['confirm_subscription'] = [
'#type' => 'checkbox',
'#title' => t('Confirm Subscriptions'),
'#default_value' => (bool) $this->settings['confirm_subscription'],
'#description' => t('Recommended. Send a confirmation email before adding contacts to publicly subscribable mailing list groups.') . '<br />' . t('Your public mailing lists:') . ' <em>',
];
$ml = $utils
->wf_crm_apivalues('group', 'get', [
'is_hidden' => 0,
'visibility' => 'Public Pages',
'group_type' => 2,
], 'title');
if ($ml) {
if (count($ml) > 4) {
$ml = array_slice($ml, 0, 3);
$ml[] = t('etc.');
}
$this->form['additional_options']['confirm_subscription']['#description'] .= implode(', ', $ml) . '</em>';
}
else {
$this->form['additional_options']['confirm_subscription']['#description'] .= t('none') . '</em>';
}
$this->form['additional_options']['block_unknown_users'] = [
'#type' => 'checkbox',
'#title' => t('Block Unknown Users'),
'#default_value' => !empty($this->settings['block_unknown_users']),
'#description' => t('Only allow users to see this form if they are logged in or following a personalized link from CiviMail.'),
];
$this->form['additional_options']['create_new_relationship'] = [
'#type' => 'checkbox',
'#title' => t('Create New Relationship'),
'#default_value' => !empty($this->settings['create_new_relationship']),
'#description' => t('If enabled, only Active relationships will load on the form, and will be updated on Submit. If there are no Active relationships then a new one will be created.'),
];
$this->form['additional_options']['disable_contact_paging'] = [
'#type' => 'checkbox',
'#title' => t('Disable Contact Paging'),
'#default_value' => !empty($this->settings['disable_contact_paging']),
'#description' => t('If enabled, contact page break will not be added on saving the form.'),
];
$this->form['additional_options']['new_contact_source'] = [
'#type' => 'textfield',
'#title' => t('Source Label'),
'#maxlength' => 255,
'#size' => 30,
'#default_value' => empty($this->settings['new_contact_source']) ? $this->webform
->label() : $this->settings['new_contact_source'],
'#description' => t('Optional "source" label for any new contact/participant/membership created by this webform.'),
];
}