You are here

private function wf_crm_admin_form::buildMessageTabs 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::buildMessageTabs()

Configure messages

1 call to wf_crm_admin_form::buildMessageTabs()
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 390
Webform CiviCRM module's admin form.

Class

wf_crm_admin_form
@file Webform CiviCRM module's admin form.

Code

private function buildMessageTabs() {
  $tokens = '<strong>' . t('Tokens for !contact', array(
    '!contact' => wf_crm_contact_label(1, $this->data, TRUE),
  )) . ':</strong> [' . implode('], [', wf_crm_get_fields('tokens')) . '].';
  $this->form['prefix'] = array(
    '#type' => 'fieldset',
    '#title' => t('Introduction Text'),
    '#description' => t('This text will appear at the top of the form. You may configure separate messages for known contacts (logged in users, or users following a hashed link from civimail) and unknown (anonymous) users.'),
    '#group' => 'webform_civicrm',
    '#attributes' => array(
      'class' => array(
        'civi-icon-text',
      ),
    ),
  );
  $this->form['prefix']['prefix_known'] = array(
    '#type' => 'textarea',
    '#title' => t('Introduction text for known contacts'),
    '#default_value' => wf_crm_aval($this->settings, 'prefix_known'),
    '#description' => $tokens,
  );
  $this->form['prefix']['prefix_unknown'] = array(
    '#type' => 'textarea',
    '#title' => t('Introduction text for unknown contacts'),
    '#default_value' => wf_crm_aval($this->settings, 'prefix_unknown'),
    '#description' => t('No tokens available for unknown contacts.'),
  );
  $this->form['st_message'] = array(
    '#type' => 'fieldset',
    '#title' => t('"Not You?" Message'),
    '#description' => t('Prompt for users who are logged in as, or following a hashed link for, someone else.'),
    '#group' => 'webform_civicrm',
    '#attributes' => array(
      'class' => array(
        'civi-icon-message',
      ),
    ),
  );
  $this->form['st_message']['toggle_message'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display message to known contacts?'),
    '#default_value' => !empty($this->settings['message']),
  );
  $this->form['st_message']['message'] = array(
    '#type' => 'textfield',
    '#title' => t('Text (displayed as a status message)'),
    '#default_value' => wf_crm_aval($this->settings, 'message', t("You are viewing this form as [display name]. Please {click here if that's not you}.")),
    '#size' => 100,
    '#maxlength' => 255,
    '#attributes' => array(
      'style' => 'max-width: 100%;',
    ),
    '#description' => t('Enclose your "not you" link text in curly brackets {like this}.') . '<p>' . $tokens . '</p>',
  );
}