You are here

function feedback_settings_form in Feedback 5

Shows a form for editing a feedback page

1 string reference to 'feedback_settings_form'
feedback_settings_page in ./feedback.module
feedback admin center

File

./feedback.module, line 117
Enables a site-wide feedback page.

Code

function feedback_settings_form($pagename) {
  $page = _feedback_get_page($pagename);
  $form['email'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Email Address'),
    '#default_value' => $page->email,
    '#size' => 80,
    '#maxlength' => 300,
    '#description' => t('The email address which should receive all form submissions'),
    '#required' => TRUE,
  );
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title of the feedback page'),
    '#default_value' => $page->title,
    '#size' => 80,
    '#maxlength' => 80,
    '#required' => TRUE,
  );
  $form['instructions'] = array(
    '#type' => 'textarea',
    '#title' => t('Instructions'),
    '#default_value' => $page->instructions,
    '#cols' => 60,
    '#rows' => 10,
    '#description' => t('The instructions that will be displayed for the user on how to fill the form'),
  );
  $form['subject'] = array(
    '#type' => 'fieldset',
    '#title' => t('Subject'),
  );
  $form['subject']['subject_prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject Prefix'),
    '#default_value' => $page->subject_prefix,
    '#size' => 80,
    '#maxlength' => 80,
    '#description' => t('The prefix that should be added before the subject on each email'),
  );
  $form['subject']['field_subject'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include a subject textfield'),
    '#return_value' => 1,
    '#default_value' => $page->field_subject,
  );
  $form['subject']['field_category'] = array(
    '#type' => 'textarea',
    '#title' => t('Categories'),
    '#default_value' => $page->field_category,
    '#cols' => 40,
    '#rows' => 6,
    '#description' => t('Put each subject category on a separate line or separate them by commas.  No HTML allowed.') . '<br />' . t('Leave this field empty to disable this feature.'),
  );
  $form['fields'] = array(
    '#type' => 'fieldset',
    '#title' => t('Fields to include on the form'),
  );
  $form['fields']['field_name'] = array(
    '#type' => 'checkbox',
    '#title' => t('Sender Name'),
    '#return_value' => 1,
    '#default_value' => $page->field_name,
  );
  $form['fields']['field_postal'] = array(
    '#type' => 'checkbox',
    '#title' => t('Postal Address'),
    '#return_value' => 1,
    '#default_value' => $page->field_postal,
  );
  $form['fields']['field_phone'] = array(
    '#type' => 'checkbox',
    '#title' => t('Phone Number'),
    '#return_value' => 1,
    '#default_value' => $page->field_phone,
  );
  $form['fields']['field_body'] = array(
    '#type' => 'checkbox',
    '#title' => t('Message Body'),
    '#return_value' => 1,
    '#default_value' => $page->field_body,
  );
  $form['misc'] = array(
    '#type' => 'fieldset',
    '#title' => t('Miscellaneous Settings'),
  );
  $form['misc']['hourly_threshold'] = array(
    '#type' => 'select',
    '#title' => t('Hourly threshold'),
    '#default_value' => $page->hourly_threshold,
    '#options' => drupal_map_assoc(array(
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      20,
      30,
      40,
      50,
    )),
    '#description' => t('The maximum number of form submissions a user can perform per hour.'),
  );
  $form['misc']['logging'] = array(
    '#type' => 'checkbox',
    '#title' => t('Log all feedback attempts to watchdog'),
    '#return_value' => 1,
    '#default_value' => $page->logging,
  );
  $form['page'] = array(
    '#type' => 'value',
    '#value' => $page,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}