You are here

function _text_captcha_word_pool_form_items in CAPTCHA Pack 6

Same name and namespace in other branches
  1. 8 text_captcha/text_captcha.module \_text_captcha_word_pool_form_items()
  2. 5 text_captcha/text_captcha.inc \_text_captcha_word_pool_form_items()
  3. 7 text_captcha/text_captcha.inc \_text_captcha_word_pool_form_items()

Helper function for setting word pool form items Locale dependent

3 calls to _text_captcha_word_pool_form_items()
lost_character_captcha_settings_form in text_captcha/lost_character_captcha/lost_character_captcha.admin.inc
Function for the settings form
phrase_captcha_settings_form in text_captcha/phrase_captcha/phrase_captcha.admin.inc
Administration form
word_list_captcha_settings_form in text_captcha/word_list_captcha/word_list_captcha.admin.inc
Function for the settings form

File

text_captcha/text_captcha.inc, line 72

Code

function _text_captcha_word_pool_form_items(&$form, $name_base, $title, $description, $default_value, $rows = 3) {
  if (module_exists('locale')) {

    // Locale available
    $langs = locale_language_list();
    $form[$name_base] = array(
      '#type' => 'fieldset',
      '#title' => t($title),
      '#description' => t($description),
      '#collapsible' => TRUE,
    );
    foreach ($langs as $lang_code => $lang_name) {
      $form[$name_base]["{$name_base}_{$lang_code}"] = array(
        '#type' => 'textarea',
        '#title' => t('For language %lang_name (code %lang_code)', array(
          '%lang_name' => $lang_name,
          '%lang_code' => $lang_code,
        )),
        '#default_value' => _text_captcha_word_pool_get_content($name_base, $lang_code, $default_value),
        '#rows' => $rows,
      );
    }
  }
  else {

    // No locale available
    $form[$name_base] = array(
      '#type' => 'textarea',
      '#title' => t($title),
      '#description' => t($description),
      '#default_value' => _text_captcha_word_pool_get_content($name_base, NULL, $default_value),
      '#rows' => $rows,
    );
  }
}