function _text_captcha_word_pool_get_content in CAPTCHA Pack 8
Same name and namespace in other branches
- 5 text_captcha/text_captcha.inc \_text_captcha_word_pool_get_content()
- 6 text_captcha/text_captcha.inc \_text_captcha_word_pool_get_content()
- 7 text_captcha/text_captcha.inc \_text_captcha_word_pool_get_content()
Helper function for getting the content of a word pool locale dependent.
4 calls to _text_captcha_word_pool_get_content()
- lost_character_captcha_captcha in text_captcha/
modules/ lost_character_captcha/ lost_character_captcha.module - Implements hook_captcha().
- _phrase_captcha_generate_words in text_captcha/
modules/ phrase_captcha/ phrase_captcha.module - Function for generating an array of words.
- _text_captcha_word_pool_form_items in text_captcha/
text_captcha.module - Helper function for setting word pool form items locale dependent.
- _word_list_captcha_get_word_list_captcha in text_captcha/
modules/ word_list_captcha/ word_list_captcha.module - Helper function for generating a word list CAPTCHA.
File
- text_captcha/
text_captcha.module, line 63 - Contains general functionality for the module.
Code
function _text_captcha_word_pool_get_content($name_base, $lang_code, $default_value, $explode = FALSE) {
switch ($name_base) {
case 'phrase_captcha_userdefined_word_pool':
$config = \Drupal::config('phrase_captcha.settings');
break;
case 'lost_character_captcha_word_pool':
$config = \Drupal::config('lost_character_captcha.settings');
break;
case 'word_list_captcha_word_pool_1':
case 'word_list_captcha_word_pool_2':
$config = \Drupal::config('word_list_captcha.settings');
break;
}
if (\Drupal::moduleHandler()
->moduleExists('locale')) {
if (!$lang_code) {
global $language;
$lang_code = $language->language;
}
$content = !empty($config
->get("{$name_base}_{$lang_code}")) ? $config
->get("{$name_base}_{$lang_code}") : $default_value;
}
else {
$content = $config
->get($name_base);
}
if ($explode) {
$content = _text_captcha_whitespace_explode($content);
}
return $content;
}