You are here

private function wf_crm_admin_form::buildOptionsTab in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/wf_crm_admin_form.inc \wf_crm_admin_form::buildOptionsTab()

Configure additional options

1 call to wf_crm_admin_form::buildOptionsTab()
wf_crm_admin_form::buildForm in includes/wf_crm_admin_form.inc
Build admin form for civicrm tab of a webform

File

includes/wf_crm_admin_form.inc, line 1130
Webform CiviCRM module's admin form.

Class

wf_crm_admin_form
@file Webform CiviCRM module's admin form.

Code

private function buildOptionsTab() {
  $this->form['options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Additional Options'),
    '#group' => 'webform_civicrm',
    '#attributes' => array(
      'class' => array(
        'civi-icon-prefs',
      ),
    ),
    '#description' => '<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:', array(
      '!contact' => wf_crm_contact_label(1, $this->data, TRUE),
    )) . '<br /><code>' . url("node/{$this->node->nid}", array(
      'absolute' => TRUE,
      'query' => array(
        'cid1' => '',
      ),
    )) . '{contact.contact_id}&amp;{contact.checksum}</code></p>',
  );
  $this->form['options']['create_fieldsets'] = array(
    '#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. Also allows the contact clone feature to work.'),
  );
  $this->form['options']['confirm_subscription'] = array(
    '#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 = wf_crm_apivalues('group', 'get', array(
    '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['options']['confirm_subscription']['#description'] .= implode(', ', $ml) . '</em>';
  }
  else {
    $this->form['options']['confirm_subscription']['#description'] .= t('none') . '</em>';
  }
  $this->form['options']['block_unknown_users'] = array(
    '#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['options']['create_new_relationship'] = array(
    '#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['options']['new_contact_source'] = array(
    '#type' => 'textfield',
    '#title' => t('Source Label'),
    '#maxlength' => 255,
    '#size' => 30,
    '#default_value' => $this->settings['new_contact_source'],
    '#description' => t('Optional "source" label for any new contact/participant/membership created by this webform.'),
  );
}