You are here

function text_captcha_settings_form in CAPTCHA 6

Same name and namespace in other branches
  1. 5.3 text_captcha/text_captcha.module \text_captcha_settings_form()

Administration form

1 string reference to 'text_captcha_settings_form'
text_captcha_menu in text_captcha/text_captcha.module
Implementation of hook_menu().

File

text_captcha/text_captcha.admin.inc, line 6

Code

function text_captcha_settings_form() {
  $form = array();

  // radio buttons for selecting the kind of words to use
  $form['text_captcha_words'] = array(
    '#type' => 'radios',
    '#title' => t('Kind of words to use in the phrase'),
    '#options' => array(
      TEXT_CAPTCHA_GENERATE_NONSENSE_WORDS => t('Generate nonsense random words.'),
      TEXT_CAPTCHA_USER_DEFINED_WORDS => t('Use user defined words.'),
    ),
    '#default_value' => variable_get('text_captcha_words', TEXT_CAPTCHA_GENERATE_NONSENSE_WORDS),
  );

  // textarea for user defined words
  $form['text_captcha_userdefined_words'] = array(
    '#type' => 'textarea',
    '#title' => t('User defined words'),
    '#default_value' => variable_get('text_captcha_userdefined_words', ''),
    '#description' => t('Enter a bunch of space separated words (at least @min).', array(
      '@min' => TEXT_CAPTCHA_USER_DEFINED_WORD_MINIMUM,
    )),
  );

  // textfield for the number of words in the CAPTCHA phrase
  $form['text_captcha_word_quantity'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of words in the phrase'),
    '#default_value' => (int) variable_get('text_captcha_word_quantity', 5),
    '#size' => 2,
    '#maxlength' => 2,
  );
  $form['#validate'][] = 'text_captcha_settings_form_validate';
  return system_settings_form($form);
}