You are here

function _random_captcha_type_get_all_types in CAPTCHA Pack 7

Same name and namespace in other branches
  1. 8 random_captcha_type/random_captcha_type.module \_random_captcha_type_get_all_types()
  2. 5 random_captcha_type/random_captcha_type.module \_random_captcha_type_get_all_types()
  3. 6 random_captcha_type/random_captcha_type.inc \_random_captcha_type_get_all_types()

Function for getting all the possible CAPTCHA types to switch between. For use as #options entry of a checkboxes widget.

2 calls to _random_captcha_type_get_all_types()
random_captcha_type_settings_form in random_captcha_type/random_captcha_type.admin.inc
Configuration form
_random_captcha_type_get_enabled_types in random_captcha_type/random_captcha_type.module
Function for getting the enabled CAPTCHA types. Alternative of variable_get('random_captcha_type_enabled_types', ...) with sensible default value. For use as #default_value of checkboxes widget. Returns an array mapping…

File

random_captcha_type/random_captcha_type.module, line 73

Code

function _random_captcha_type_get_all_types() {
  $captcha_types = array();
  foreach (module_implements('captcha') as $module) {

    // Skip random_captcha_type module
    if ($module == 'random_captcha_type') {
      continue;
    }

    // Get available  types
    $result = module_invoke($module, 'captcha', 'list');
    if (is_array($result)) {
      foreach ($result as $type) {
        $captcha_types["{$module}/{$type}"] = "{$type} ({$module})";
      }
    }
  }
  return $captcha_types;
}