You are here

function answers_settings in Answers 7.3

Same name and namespace in other branches
  1. 5.2 answers.module \answers_settings()
  2. 6.2 answers.module \answers_settings()
  3. 7.4 answers.module \answers_settings()
  4. 7 answers.module \answers_settings()
  5. 7.2 answers.module \answers_settings()

Returns the form definition for answers administer page.

1 string reference to 'answers_settings'
answers_menu in ./answers.module
Implements hook_menu().

File

includes/answers.form.inc, line 11
Form utility functions for the 'Answers' module.

Code

function answers_settings() {
  $form = array();
  $form['additional_settings'] = array(
    '#type' => 'vertical_tabs',
    '#attached' => array(
      'js' => array(
        drupal_get_path('module', 'answers') . '/js/answers_admin.js',
      ),
    ),
  );
  $form['display'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Display'),
    '#weight' => -100,
    '#group' => 'additional_settings',
  );
  $form['display']['answers_redirect_from_answer_to_question_nodes_p'] = array(
    '#type' => 'checkbox',
    '#title' => t('Redirect paths from answers to questions'),
    '#default_value' => variable_get('answers_redirect_from_answer_to_question_nodes_p', TRUE),
    '#description' => t('This will redirect from showing answer nodes in page view to instead showing the question node in page view, scrolling down to the answer. (Recommended)'),
  );
  $form['display']['answers_hide_question_reference_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide %field field', array(
      '%field' => 'answer to question',
    )),
    '#default_value' => variable_get('answers_hide_question_reference_field', TRUE),
    '#description' => t('This will hide the %field field when users create an answer to a question.', array(
      '%field' => 'answer to question',
    )),
  );
  $form['notification'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Notification'),
    '#weight' => -50,
    '#group' => 'additional_settings',
  );
  $form['notification']['answers_new_answer_notice_allow_p'] = array(
    '#type' => 'checkbox',
    '#title' => t('Give users the option to be notified'),
    '#default_value' => variable_get('answers_new_answer_notice_allow_p', TRUE),
    '#description' => t('If disabled, users will not be offered the option to receive notifications. Also, any new answers to questions will not trigger notifications, even if their authors had previously requested notification.'),
  );
  $form['notification']['answers_new_answer_notice_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject line'),
    '#default_value' => variable_get('answers_new_answer_notice_subject', ANSWERS_DEFAULT_NEW_ANSWER_NOTICE_SUBJECT),
    '#description' => t('Dynamic variables available: !question_user_name, !answer_user_name, !question_title, !question_url, !site and !site_url'),
    '#required' => TRUE,
  );
  $form['notification']['answers_new_answer_notice_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#default_value' => variable_get('answers_new_answer_notice_body', ANSWERS_DEFAULT_NEW_ANSWER_NOTICE_BODY),
    '#description' => t('Dynamic variables available: !question_user_name, !answer_user_name, !question_title, !question_url, !site and !site_url'),
    '#required' => TRUE,
  );
  return system_settings_form($form);
}