function _captcha_available_challenge_types in CAPTCHA 7
Same name and namespace in other branches
- 5.3 captcha.module \_captcha_available_challenge_types()
- 6.2 captcha.admin.inc \_captcha_available_challenge_types()
- 6 captcha.admin.inc \_captcha_available_challenge_types()
Return an array with the available CAPTCHA types, for use as options array for a select form elements.
Parameters
bool $add_special_options: if true: also add a 'none' and 'default' option
Return value
array Mapping "$module/$type" to "$type (from module $module)" with $module the module name implementing the CAPTCHA and $type the name of the CAPTCHA type.
2 calls to _captcha_available_challenge_types()
- captcha_admin_settings in ./
captcha.admin.inc - Form builder function for the general CAPTCHA configuration.
- captcha_point_admin_form in ./
captcha.admin.inc - Admin form.
File
- ./
captcha.admin.inc, line 19 - Functionality and helper functions for CAPTCHA administration.
Code
function _captcha_available_challenge_types($add_special_options = TRUE) {
$captcha_types = array();
if ($add_special_options) {
$captcha_types['none'] = t('- No challenge -');
$captcha_types['default'] = t('Default challenge type');
}
// We do our own version of Drupal's module_invoke_all() here because
// we want to build an array with custom keys and values.
foreach (module_implements('captcha') as $module) {
$result = call_user_func_array($module . '_captcha', array(
'list',
));
if (is_array($result)) {
foreach ($result as $type) {
$captcha_types["{$module}/{$type}"] = t('@type (from module @module)', array(
'@type' => $type,
'@module' => $module,
));
}
}
}
return $captcha_types;
}