You are here

function lost_character_captcha_settings_form in CAPTCHA Pack 6

Same name and namespace in other branches
  1. 5 text_captcha/lost_character_captcha/lost_character_captcha.module \lost_character_captcha_settings_form()
  2. 7 text_captcha/lost_character_captcha/lost_character_captcha.admin.inc \lost_character_captcha_settings_form()

Function for the settings form

1 string reference to 'lost_character_captcha_settings_form'
lost_character_captcha_menu in text_captcha/lost_character_captcha/lost_character_captcha.module
Implementation of hook_menu().

File

text_captcha/lost_character_captcha/lost_character_captcha.admin.inc, line 6

Code

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

  // form element for the number of characters to lose
  $form['lost_character_captcha_quantity'] = array(
    '#type' => 'select',
    '#title' => t('Number of characters to lose'),
    '#default_value' => variable_get('lost_character_captcha_quantity', 1),
    '#description' => t('Select how many characters should be lost in the CAPTCHA.'),
    '#options' => array(
      1 => 1,
      2 => 2,
      3 => 3,
    ),
  );

  // form element for hinting
  $form['lost_character_captcha_enable_hint'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put "%hinter" where the characters are lost as a hint', array(
      '%hinter' => LOST_CHARACTER_CAPTCHA_HINTER,
    )),
    '#default_value' => variable_get('lost_character_captcha_enable_hint', TRUE),
    '#description' => t('Enable this option to make it easier to determine the lost characters.'),
  );

  // form elements for the word pool
  _text_captcha_word_pool_form_items($form, 'lost_character_captcha_word_pool', 'Word pool', 'Enter the words to use, separated with spaces. Make sure every word is unambiguously recognizable when characters are lost. Avoid for example verbs, adverbs, plural forms, too short words, names. Also make sure the words are well known to your intended public.', LOST_CHARACTER_CAPTCHA_DEFAULT_WORD_POOL);

  // add a pre_render callback
  $form['#pre_render'] = array(
    'lost_character_captcha_settings_form_pre_render',
  );
  $form['#validate'] = array(
    'lost_character_captcha_settings_form_validate',
  );

  // add buttons and return
  return system_settings_form($form);
}