You are here

function constant_contact_admin_settings in Constant Contact 5

Same name and namespace in other branches
  1. 6 constant_contact.module \constant_contact_admin_settings()

Implementation of hook_form()

1 string reference to 'constant_contact_admin_settings'
constant_contact_menu in ./constant_contact.module
Implementation of hook_menu().

File

./constant_contact.module, line 99

Code

function constant_contact_admin_settings() {
  $form = array();
  $form['constant_contact_server'] = array(
    '#type' => 'fieldset',
    '#title' => t('Server Settings'),
    '#description' => t('Put your Constant Contact login info in here'),
    '#collapsible' => true,
  );
  $form['constant_contact_server']['constant_contact_username'] = array(
    '#type' => 'textfield',
    '#title' => t('Username'),
    '#default_value' => variable_get('constant_contact_username', ''),
    '#size' => 30,
    '#description' => t('The username you use to login to Constant Contact'),
  );
  $form['constant_contact_server']['constant_contact_password'] = array(
    '#type' => 'textfield',
    '#title' => t('Password'),
    '#default_value' => variable_get('constant_contact_password', ''),
    '#size' => 30,
    '#description' => t('The password you use to login to Constant Contact'),
  );
  $form['constant_contact_server']['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced'),
    '#collapsible' => true,
    '#collapsed' => true,
  );
  $form['constant_contact_server']['advanced']['constant_contact_addurl'] = array(
    '#type' => 'textfield',
    '#title' => t('Add Url'),
    '#default_value' => variable_get('constant_contact_addurl', 'http://ui.constantcontact.com/roving/wdk/API_AddSiteVisitor.jsp'),
    '#description' => t('The url of the add server'),
  );
  $form['constant_contact_server']['advanced']['constant_contact_delurl'] = array(
    '#type' => 'textfield',
    '#title' => t('Remove Url'),
    '#default_value' => variable_get('constant_contact_delurl', 'http://ui.constantcontact.com/roving/wdk/API_UnsubscribeSiteVisitor.jsp'),
    '#description' => t('The url of the remove server'),
  );
  $form['email'] = array(
    '#type' => 'fieldset',
    '#title' => t('Confirmation Email'),
    '#description' => t('Customize the e-mail that is sent when the user registers. Available variables are: !list_name, !uri_list_unsubscribe, !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !login_url.'),
    '#collapsible' => true,
  );
  $form['email']['constant_contact_sendemail'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send Email'),
    '#default_value' => variable_get('constant_contact_sendemail', TRUE),
  );
  $form['email']['constant_contact_email_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => variable_get('constant_contact_email_subject', 'Welcome to !list_name Mailing List!'),
  );
  $form['email']['constant_contact_email_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#default_value' => variable_get('constant_contact_email_body', "Dear !username,\nThanks for joining the !list_name mailing list at !uri. If you would like to unsubscribe, use the following URL: !uri_list_unsubscribe\nThanks,\nThe !site Team"),
  );
  $form['constant_contact_lists'] = array(
    '#type' => 'fieldset',
    '#title' => t('List Settings'),
    '#description' => t('Settings for particular mailing lists'),
    '#collapsible' => true,
  );
  $form['constant_contact_lists']['constant_contact_allowanon'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow anonymous Users'),
    '#default_value' => variable_get('constant_contact_allowanon', TRUE),
    '#description' => t('Can non-logged-in users add themselves to lists?  If so, a form will be displayed that will allow them to enter their email address.'),
  );
  $form['constant_contact_lists']['constant_contact_lists'] = array(
    '#type' => 'textarea',
    '#title' => t('Lists'),
    '#default_value' => variable_get('constant_contact_lists', ''),
    '#size' => 30,
    '#description' => t('Put all your Constant Contact mailing lists that you want integration for in here, one per line. I recommend using names shorter then 21 characters, so the keys will be distinct.'),
  );
  $form['constant_contact_lists']['blocktext'] = array(
    '#type' => 'fieldset',
    '#title' => t('Block Text'),
    '#description' => t('The text that appears in the signup block'),
    '#collapsible' => true,
    '#collapsed' => true,
  );
  $lists = constant_contact_get_lists();
  foreach ($lists as $keyname => $list) {
    $form['constant_contact_lists']['blocktext'][$keyname] = array(
      '#type' => 'textfield',
      '#title' => $list . t(' text'),
      '#default_value' => variable_get($keyname, "Join {$list} Mailing List"),
      '#size' => 30,
    );
  }
  return system_settings_form($form);
}