You are here

function support_admin_mail_settings in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support.admin.inc \support_admin_mail_settings()

Settings form for email texts

1 string reference to 'support_admin_mail_settings'
support_menu in ./support.module
Implementation of hook_menu().

File

./support.admin.inc, line 625
support.admin.inc

Code

function support_admin_mail_settings() {
  $default_texts = _support_mail_text_default(NULL);
  $textgroups = array(
    'new' => t('New ticket'),
    'comment_new' => t('Updated ticket'),
    'deny' => t('Ticket creation denied'),
  );
  $form = array();
  foreach ($textgroups as $key => $description) {
    $text_key = 'ticket_' . $key;
    $var_key = 'support_mail_' . $text_key;
    $form[$text_key] = array(
      '#type' => 'fieldset',
      '#title' => t('!setting notification', array(
        '!setting' => $description,
      )),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form[$text_key][$var_key . '_subject'] = array(
      '#type' => 'textfield',
      '#title' => t('Subject'),
      '#description' => t('The email subject for !setting notifications.', array(
        '!setting' => strtolower($description),
      )),
      '#default_value' => variable_get($var_key . '_subject', $default_texts[$text_key . '_subject']),
      '#required' => TRUE,
    );
    $form[$text_key][$var_key . '_body'] = array(
      '#type' => 'textarea',
      '#title' => t('Body'),
      '#description' => t('The email body for !setting notifications.', array(
        '!setting' => strtolower($description),
      )),
      '#default_value' => variable_get($var_key . '_body', $default_texts[$text_key . '_body']),
      '#rows' => 15,
      '#required' => TRUE,
    );
  }
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General mail settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['general']['support_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Notification key prefix'),
    '#description' => t('Used for email threading, appears in notification email subjects as "[!key:12345]"', array(
      '!key' => variable_get('support_key', 'tkt'),
    )),
    '#default_value' => variable_get('support_key', 'tkt'),
    '#required' => TRUE,
  );
  return system_settings_form($form);
}