You are here

function answers_settings in Answers 5.2

Same name and namespace in other branches
  1. 6.2 answers.module \answers_settings()
  2. 7.4 answers.module \answers_settings()
  3. 7 answers.module \answers_settings()
  4. 7.2 answers.module \answers_settings()
  5. 7.3 includes/answers.form.inc \answers_settings()

Implementation of hook_menu().

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

File

./answers.module, line 70
Enables the creation of question nodes that can be answered by posting answer nodes.

Code

function answers_settings() {
  $form['answermodules'] = array(
    '#type' => 'fieldset',
    '#description' => t('Select content types you wish to use to answer the questions posted.'),
    '#weight' => -3,
    '#title' => t('Answers Modules'),
  );
  $form['answermodules']['formtypes'] = array();
  $form['answermodules']['formtypes'] = array_merge($form['answermodules']['formtypes'], module_invoke_all('answers', 'settings'));
  $form['answers_settings'] = array(
    '#type' => 'fieldset',
    '#weight' => -2,
    '#title' => t('General Settings'),
  );
  $answers_email = "\nHi %name,\n<br />\n%addername has posted a %ansertype on the quest - \" %title \".\n<br />\nView your quest: %url \n<br />\n<hr />\n\nThis is an automatic message from %site.\n<br />\n  ";
  $answers_subject = '@name an new answer was posted to your question: @subject';
  $form['answers_settings']['answernotify'] = array(
    '#type' => 'textarea',
    '#title' => t('Notify email user of a posted answer'),
    '#default_value' => variable_get('answernotify', $answers_email),
    '#description' => t('This is the email that is sent to users. Dynamic vars available: %name, %subject, %addername, %title, %url, %ansertype and %site'),
    '#weight' => 2,
    '#required' => TRUE,
  );
  $form['answers_settings']['answernotifysubject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject of notify email'),
    '#default_value' => variable_get('answernotifysubject', $answers_subject),
    '#description' => t('This is the subject line of the email sent. Dynamic vars available: @name, @subject'),
    '#weight' => 1,
    '#required' => TRUE,
  );
  $form['answers_settings']['allow_answeranon'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow anonimization'),
    '#options' => array(
      '0',
      '1',
    ),
    '#default_value' => variable_get('allow_answeranon', 0),
    '#description' => t('Allow users to post questions anonymously. NOTE: the question still belongs to the user the name is just hidden from normal users'),
    '#required' => FALSE,
  );
  $form['answers_settings']['questlinks'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Drupal\'s links to show answers totals'),
    '#options' => array(
      '0',
      '1',
    ),
    '#default_value' => variable_get('questlinks', ''),
    '#description' => t('If you plan to layout the total answers in your theme instead uncheck this box.'),
    '#weight' => 3,
  );
  return system_settings_form($form);
}